You are here

public function PromiseTest::testGetsActualWaitValueFromThen in Zircon Profile 8

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

File

vendor/guzzlehttp/promises/tests/PromiseTest.php, line 152

Class

PromiseTest
@covers GuzzleHttp\Promise\Promise

Namespace

GuzzleHttp\Promise\Tests

Code

public function testGetsActualWaitValueFromThen() {
  $p = new Promise(function () use (&$p) {
    $p
      ->reject('Foo!');
  });
  $p2 = $p
    ->then(null, function ($reason) {
    return new RejectedPromise([
      $reason,
    ]);
  });
  try {
    $p2
      ->wait();
    $this
      ->fail('Should have thrown');
  } catch (RejectionException $e) {
    $this
      ->assertEquals([
      'Foo!',
    ], $e
      ->getReason());
  }
}