You are here

public function FunctionsTest::testSomeRejectsWhenTooManyRejections in Zircon Profile 8

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

File

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

Class

FunctionsTest

Namespace

GuzzleHttp\Promise\Tests

Code

public function testSomeRejectsWhenTooManyRejections() {
  $a = new Promise();
  $b = new Promise();
  $d = \GuzzleHttp\Promise\some(2, [
    $a,
    $b,
  ]);
  $a
    ->reject('bad');
  $b
    ->resolve('good');
  P\queue()
    ->run();
  $this
    ->assertEquals($a::REJECTED, $d
    ->getState());
  $d
    ->then(null, function ($reason) use (&$called) {
    $called = $reason;
  });
  P\queue()
    ->run();
  $this
    ->assertInstanceOf('GuzzleHttp\\Promise\\AggregateException', $called);
  $this
    ->assertContains('bad', $called
    ->getReason());
}