public function PromiseTest::testForwardsReturnedRejectedPromisesDownChainBetweenGaps in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/guzzlehttp/promises/tests/PromiseTest.php \GuzzleHttp\Promise\Tests\PromiseTest::testForwardsReturnedRejectedPromisesDownChainBetweenGaps()
File
- vendor/
guzzlehttp/ promises/ tests/ PromiseTest.php, line 401
Class
Namespace
GuzzleHttp\Promise\TestsCode
public function testForwardsReturnedRejectedPromisesDownChainBetweenGaps() {
$p = new Promise();
$rejected = new RejectedPromise('bar');
$r = $r2 = null;
$p
->then(null, null)
->then(null, function ($v) use (&$r, $rejected) {
$r = $v;
return $rejected;
})
->then(null, function ($v) use (&$r2) {
$r2 = $v;
});
$p
->reject('foo');
P\queue()
->run();
$this
->assertEquals('foo', $r);
$this
->assertEquals('bar', $r2);
try {
$p
->wait();
} catch (RejectionException $e) {
$this
->assertEquals('foo', $e
->getReason());
}
}