You are here

public function RejectedPromiseTest::testReturnsNewRejectedWhenOnRejectedFails in Zircon Profile 8

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

File

vendor/guzzlehttp/promises/tests/RejectedPromiseTest.php, line 95

Class

RejectedPromiseTest
@covers GuzzleHttp\Promise\RejectedPromise

Namespace

GuzzleHttp\Promise\Tests

Code

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