mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-08 01:05:37 +08:00
initial 2.0.0-a2 commit
This commit is contained in:
28
test/CoroutinePoolTest.php
Normal file
28
test/CoroutinePoolTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use ZM\Console\Console;
|
||||
use ZM\Requests\ZMRequest;
|
||||
use ZM\Utils\CoroutinePool;
|
||||
|
||||
class CoroutinePoolTest extends TestCase
|
||||
{
|
||||
public function testStart() {
|
||||
$this->assertTrue(true);
|
||||
Console::init(4);
|
||||
CoroutinePool::setSize("default", 2);
|
||||
CoroutinePool::defaultSize(50);
|
||||
for ($i = 0; $i < 59; ++$i) {
|
||||
CoroutinePool::go(function () use ($i) {
|
||||
//Console::debug("第 $i 个马上进入睡眠...");
|
||||
ZMRequest::get("http://localhost:9002/test/ping");
|
||||
Console::verbose(strval($i));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function testA() {
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user