You are here

public function FulfilledPromiseTest::testReturnsNewRejectedWhenOnFulfilledFails in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/guzzlehttp/promises/tests/FulfilledPromiseTest.php \GuzzleHttp\Tests\Promise\FulfilledPromiseTest::testReturnsNewRejectedWhenOnFulfilledFails()

File

vendor/guzzlehttp/promises/tests/FulfilledPromiseTest.php, line 79

Class

FulfilledPromiseTest
@covers GuzzleHttp\Promise\FulfilledPromise

Namespace

GuzzleHttp\Tests\Promise

Code

public function testReturnsNewRejectedWhenOnFulfilledFails() {
  $p = new FulfilledPromise('a');
  $f = function () {
    throw new \Exception('b');
  };
  $p2 = $p
    ->then($f);
  $this
    ->assertNotSame($p, $p2);
  try {
    $p2
      ->wait();
    $this
      ->fail();
  } catch (\Exception $e) {
    $this
      ->assertEquals('b', $e
      ->getMessage());
  }
}