You are here

public function FunctionsTest::testCanScheduleThunkWithRejection in Zircon Profile 8

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

File

vendor/guzzlehttp/promises/tests/functionsTest.php, line 314

Class

FunctionsTest

Namespace

GuzzleHttp\Promise\Tests

Code

public function testCanScheduleThunkWithRejection() {
  $tramp = P\queue();
  $promise = P\task(function () {
    throw new \Exception('Hi!');
  });
  $c = null;
  $promise
    ->otherwise(function ($v) use (&$c) {
    $c = $v;
  });
  $this
    ->assertNull($c);
  $tramp
    ->run();
  $this
    ->assertEquals('Hi!', $c
    ->getMessage());
}