You are here

public function FunctionsTest::testCanYieldFinalPendingPromise in Zircon Profile 8

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

File

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

Class

FunctionsTest

Namespace

GuzzleHttp\Promise\Tests

Code

public function testCanYieldFinalPendingPromise() {
  $p1 = new P\Promise();
  $p2 = new P\Promise();
  $co = P\coroutine(function () use ($p1, $p2) {
    (yield $p1);
    (yield $p2);
  });
  $p1
    ->resolve('a');
  $p2
    ->resolve('b');
  $co
    ->then(function ($value) use (&$result) {
    $result = $value;
  });
  P\queue()
    ->run();
  $this
    ->assertEquals('b', $result);
}