You are here

public function FunctionsTest::testAllThrowsWhenAnyRejected in Zircon Profile 8

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

File

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

Class

FunctionsTest

Namespace

GuzzleHttp\Promise\Tests

Code

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