You are here

public function FunctionsTest::testRejectsParentExceptionWhenException in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/promises/tests/functionsTest.php \GuzzleHttp\Promise\Tests\FunctionsTest::testRejectsParentExceptionWhenException()

File

vendor/guzzlehttp/promises/tests/functionsTest.php, line 361

Class

FunctionsTest

Namespace

GuzzleHttp\Promise\Tests

Code

public function testRejectsParentExceptionWhenException() {
  $promise = P\coroutine(function () {
    (yield new P\FulfilledPromise(0));
    throw new \Exception('a');
  });
  $promise
    ->then(function () {
    $this
      ->fail();
  }, function ($reason) use (&$result) {
    $result = $reason;
  });
  P\queue()
    ->run();
  $this
    ->assertInstanceOf('Exception', $result);
  $this
    ->assertEquals('a', $result
    ->getMessage());
}