You are here

public function RejectedPromiseTest::testThrowsReasonWhenWaitedUpon in Zircon Profile 8

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

File

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

Class

RejectedPromiseTest
@covers GuzzleHttp\Promise\RejectedPromise

Namespace

GuzzleHttp\Promise\Tests

Code

public function testThrowsReasonWhenWaitedUpon() {
  $p = new RejectedPromise('foo');
  $this
    ->assertEquals('rejected', $p
    ->getState());
  try {
    $p
      ->wait(true);
    $this
      ->fail();
  } catch (\Exception $e) {
    $this
      ->assertEquals('rejected', $p
      ->getState());
    $this
      ->assertContains('foo', $e
      ->getMessage());
  }
}