-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
兼容swoole 4.0.3版本 (swoft-cloud/swoft-component#166)
* 判断swoole版本使用version_compare * 更新单测 * 当swoole版本号大于4.0.3,使用channel->pop代替channel->select * 增加单测 * 修改 Travis Ci swoole版本
- Loading branch information
1 parent
80b5176
commit 7ad5be6
Showing
8 changed files
with
147 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
namespace SwoftTest\Connection; | ||
|
||
use Swoft\Pool\AbstractConnection; | ||
|
||
class DemoConnection extends AbstractConnection | ||
{ | ||
/** | ||
* @var Client | ||
*/ | ||
protected $connection; | ||
|
||
public function createConnection() | ||
{ | ||
$this->connection = new \stdClass(); | ||
$this->connection->id = uniqid(); | ||
} | ||
|
||
public function reconnect() | ||
{ | ||
$this->createConnection(); | ||
} | ||
|
||
public function check(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function getConnection() | ||
{ | ||
return $this->connection; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
namespace SwoftTest; | ||
|
||
use Swoft\Core\Coroutine; | ||
|
||
/** | ||
* Class CorouotineTest | ||
* | ||
* @package Swoft\Test\Cases | ||
*/ | ||
class CorouotineTest extends AbstractTestCase | ||
{ | ||
public function testIsSupportCoroutine() | ||
{ | ||
$this->assertTrue(Coroutine::isSupportCoroutine()); | ||
} | ||
|
||
public function testShouldWrapCoroutine() | ||
{ | ||
$this->assertFalse(Coroutine::shouldWrapCoroutine()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
namespace SwoftTest\Pool; | ||
|
||
use Swoft\Bean\Annotation\Bean; | ||
use Swoft\Bean\Annotation\Value; | ||
use Swoft\Pool\ConnectionInterface; | ||
use Swoft\Pool\ConnectionPool; | ||
use Swoft\Pool\PoolProperties; | ||
use SwoftTest\Connection\DemoConnection; | ||
use Swoft\Bean\Annotation\Inject; | ||
use Swoft\Bean\Annotation\Pool; | ||
|
||
/** | ||
* Class DemoPool | ||
* @Pool() | ||
* @package SwoftTest\Pool | ||
*/ | ||
class DemoPool extends ConnectionPool | ||
{ | ||
/** | ||
* The config of poolbPool | ||
* | ||
* @Inject() | ||
* | ||
* @var DemoPoolConfig | ||
*/ | ||
protected $poolConfig; | ||
|
||
public function createConnection(): ConnectionInterface | ||
{ | ||
return new DemoConnection($this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
namespace SwoftTest\Pool; | ||
|
||
use Swoft\Bean\Annotation\Bean; | ||
use Swoft\Bean\Annotation\Value; | ||
use Swoft\Pool\PoolProperties; | ||
|
||
/** | ||
* the config of env | ||
* | ||
* @Bean | ||
*/ | ||
class DemoPoolConfig extends PoolProperties | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters