You are here

public function PromiseTest::testWaitsOnNestedPromises in Zircon Profile 8

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

File

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

Class

PromiseTest
@covers GuzzleHttp\Promise\Promise

Namespace

GuzzleHttp\Promise\Tests

Code

public function testWaitsOnNestedPromises() {
  $p = new Promise(function () use (&$p) {
    $p
      ->resolve('_');
  });
  $p2 = new Promise(function () use (&$p2) {
    $p2
      ->resolve('foo');
  });
  $p3 = $p
    ->then(function () use ($p2) {
    return $p2;
  });
  $this
    ->assertSame('foo', $p3
    ->wait());
}