You are here

public function PromiseTest::testRejectsSelfWhenWaitThrows in Zircon Profile 8.0

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

File

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

Class

PromiseTest
@covers GuzzleHttp\Promise\Promise

Namespace

GuzzleHttp\Promise\Tests

Code

public function testRejectsSelfWhenWaitThrows() {
  $e = new \UnexpectedValueException('foo');
  $p = new Promise(function () use ($e) {
    throw $e;
  });
  try {
    $p
      ->wait();
    $this
      ->fail();
  } catch (\UnexpectedValueException $e) {
    $this
      ->assertEquals('rejected', $p
      ->getState());
  }
}