public function FunctionsTest::testCanWaitOnErroredPromises in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/guzzlehttp/promises/tests/functionsTest.php \GuzzleHttp\Promise\Tests\FunctionsTest::testCanWaitOnErroredPromises()
File
- vendor/
guzzlehttp/ promises/ tests/ functionsTest.php, line 648
Class
Namespace
GuzzleHttp\Promise\TestsCode
public function testCanWaitOnErroredPromises() {
$p1 = new P\Promise(function () use (&$p1) {
$p1
->reject('a');
});
$p2 = new P\Promise(function () use (&$p2) {
$p2
->resolve('b');
});
$p3 = new P\Promise(function () use (&$p3) {
$p3
->resolve('c');
});
$p4 = new P\Promise(function () use (&$p4) {
$p4
->reject('d');
});
$p5 = new P\Promise(function () use (&$p5) {
$p5
->resolve('e');
});
$p6 = new P\Promise(function () use (&$p6) {
$p6
->reject('f');
});
$co = P\coroutine(function () use ($p1, $p2, $p3, $p4, $p5, $p6) {
try {
(yield $p1);
} catch (\Exception $e) {
(yield $p2);
try {
(yield $p3);
(yield $p4);
} catch (\Exception $e) {
(yield $p5);
(yield $p6);
}
}
});
$res = P\inspect($co);
$this
->assertEquals('f', $res['reason']);
}