public function FunctionsTest::testCanCatchAndYieldOtherException in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/guzzlehttp/promises/tests/functionsTest.php \GuzzleHttp\Promise\Tests\FunctionsTest::testCanCatchAndYieldOtherException()
File
- vendor/
guzzlehttp/ promises/ tests/ functionsTest.php, line 424
Class
Namespace
GuzzleHttp\Promise\TestsCode
public function testCanCatchAndYieldOtherException() {
$promise = P\coroutine(function () {
try {
(yield new P\RejectedPromise('a'));
$this
->fail('Should have thrown into the coroutine!');
} catch (P\RejectionException $e) {
(yield new P\RejectedPromise('foo'));
}
});
$promise
->otherwise(function ($value) use (&$result) {
$result = $value;
});
P\queue()
->run();
$this
->assertEquals(P\PromiseInterface::REJECTED, $promise
->getState());
$this
->assertContains('foo', $result
->getMessage());
}