public function FunctionsTest::testCanWaitOnPromiseAfterFulfilled in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/guzzlehttp/promises/tests/functionsTest.php \GuzzleHttp\Promise\Tests\FunctionsTest::testCanWaitOnPromiseAfterFulfilled()
File
- vendor/
guzzlehttp/ promises/ tests/ functionsTest.php, line 623
Class
Namespace
GuzzleHttp\Promise\TestsCode
public function testCanWaitOnPromiseAfterFulfilled() {
$f = function () {
static $i = 0;
$i++;
return $p = new P\Promise(function () use (&$p, $i) {
$p
->resolve($i . '-bar');
});
};
$promises = [];
for ($i = 0; $i < 20; $i++) {
$promises[] = $f();
}
$p = P\coroutine(function () use ($promises) {
(yield new P\FulfilledPromise('foo!'));
foreach ($promises as $promise) {
(yield $promise);
}
});
$this
->assertEquals('20-bar', $p
->wait());
}