mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-04 12:47:55 +08:00
Update ParallelTest.php
This commit is contained in:
parent
41e4ced7cf
commit
636d571c94
@ -24,7 +24,6 @@ class ParallelTest extends TestCase
|
||||
{
|
||||
public function testParallel()
|
||||
{
|
||||
$id = Coroutine::id();
|
||||
// Closure
|
||||
$parallel = new Parallel();
|
||||
for ($i = 0; $i < 3; ++$i) {
|
||||
@ -33,7 +32,8 @@ class ParallelTest extends TestCase
|
||||
});
|
||||
}
|
||||
$result = $parallel->wait();
|
||||
$this->assertSame([$id + 1, $id + 2, $id + 3], $result);
|
||||
$id = $result[0];
|
||||
$this->assertSame([$id, $id + 1, $id + 2], $result);
|
||||
|
||||
// Array
|
||||
$parallel = new Parallel();
|
||||
@ -41,7 +41,8 @@ class ParallelTest extends TestCase
|
||||
$parallel->add([$this, 'returnCoId']);
|
||||
}
|
||||
$result = $parallel->wait();
|
||||
$this->assertSame([$id + 4, $id + 5, $id + 6], $result);
|
||||
$id = $result[0];
|
||||
$this->assertSame([$id, $id + 1, $id + 2], $result);
|
||||
}
|
||||
|
||||
public function returnCoId()
|
||||
|
Loading…
Reference in New Issue
Block a user