Update ParallelTest.php

This commit is contained in:
李铭昕 2019-08-02 15:16:19 +08:00
parent 41e4ced7cf
commit 636d571c94

View File

@ -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()