You are here

public function PromiseTest::testStacksThenWaitFunctions in Zircon Profile 8

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

File

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

Class

PromiseTest
@covers GuzzleHttp\Promise\Promise

Namespace

GuzzleHttp\Promise\Tests

Code

public function testStacksThenWaitFunctions() {
  $p1 = new Promise(function () use (&$p1) {
    $p1
      ->resolve('a');
  });
  $p2 = new Promise(function () use (&$p2) {
    $p2
      ->resolve('b');
  });
  $p3 = new Promise(function () use (&$p3) {
    $p3
      ->resolve('c');
  });
  $p4 = $p1
    ->then(function () use ($p2) {
    return $p2;
  })
    ->then(function () use ($p3) {
    return $p3;
  });
  $this
    ->assertEquals('c', $p4
    ->wait());
}