You are here

public function PromiseTest::testRejectsPromiseWhenCancelFails in Zircon Profile 8

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

File

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

Class

PromiseTest
@covers GuzzleHttp\Promise\Promise

Namespace

GuzzleHttp\Promise\Tests

Code

public function testRejectsPromiseWhenCancelFails() {
  $called = false;
  $p = new Promise(null, function () use (&$called) {
    $called = true;
    throw new \Exception('e');
  });
  $p
    ->cancel();
  $this
    ->assertEquals('rejected', $p
    ->getState());
  $this
    ->assertTrue($called);
  try {
    $p
      ->wait();
    $this
      ->fail();
  } catch (\Exception $e) {
    $this
      ->assertEquals('e', $e
      ->getMessage());
  }
}