You are here

public function FunctionsTest::testYieldFinalWaitablePromise in Zircon Profile 8

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

File

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

Class

FunctionsTest

Namespace

GuzzleHttp\Promise\Tests

Code

public function testYieldFinalWaitablePromise() {
  $p1 = new P\Promise(function () use (&$p1) {
    $p1
      ->resolve('skip me');
  });
  $p2 = new P\Promise(function () use (&$p2) {
    $p2
      ->resolve('hello!');
  });
  $co = P\coroutine(function () use ($p1, $p2) {
    (yield $p1);
    (yield $p2);
  });
  P\queue()
    ->run();
  $this
    ->assertEquals('hello!', $co
    ->wait());
}