You are here

public function FunctionsTest::testYieldsFromCoroutine in Zircon Profile 8

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

File

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

Class

FunctionsTest

Namespace

GuzzleHttp\Promise\Tests

Code

public function testYieldsFromCoroutine() {
  $promise = P\coroutine(function () {
    $value = (yield new P\FulfilledPromise('a'));
    (yield $value . 'b');
  });
  $promise
    ->then(function ($value) use (&$result) {
    $result = $value;
  });
  P\queue()
    ->run();
  $this
    ->assertEquals('ab', $result);
}