You are here

public function PromiseTest::testForwardsHandlersToNextPromise in Zircon Profile 8

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

File

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

Class

PromiseTest
@covers GuzzleHttp\Promise\Promise

Namespace

GuzzleHttp\Promise\Tests

Code

public function testForwardsHandlersToNextPromise() {
  $p = new Promise();
  $p2 = new Promise();
  $resolved = null;
  $p
    ->then(function ($v) use ($p2) {
    return $p2;
  })
    ->then(function ($value) use (&$resolved) {
    $resolved = $value;
  });
  $p
    ->resolve('a');
  $p2
    ->resolve('b');
  P\queue()
    ->run();
  $this
    ->assertEquals('b', $resolved);
}