You are here

public function FunctionsTest::testAllAggregatesSortedArray in Zircon Profile 8.0

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

File

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

Class

FunctionsTest

Namespace

GuzzleHttp\Promise\Tests

Code

public function testAllAggregatesSortedArray() {
  $a = new Promise();
  $b = new Promise();
  $c = new Promise();
  $d = \GuzzleHttp\Promise\all([
    $a,
    $b,
    $c,
  ]);
  $b
    ->resolve('b');
  $a
    ->resolve('a');
  $c
    ->resolve('c');
  $d
    ->then(function ($value) use (&$result) {
    $result = $value;
  }, function ($reason) use (&$result) {
    $result = $reason;
  });
  P\queue()
    ->run();
  $this
    ->assertEquals([
    'a',
    'b',
    'c',
  ], $result);
}