You are here

public function EachPromiseTest::testRejectsAggregateWhenNextThrows in Zircon Profile 8.0

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

File

vendor/guzzlehttp/promises/tests/EachPromiseTest.php, line 220

Class

EachPromiseTest
@covers GuzzleHttp\Promise\EachPromise

Namespace

GuzzleHttp\Promise\Tests

Code

public function testRejectsAggregateWhenNextThrows() {
  $iter = function () {
    (yield 'a');
    throw new \Exception('Failure');
  };
  $each = new EachPromise($iter());
  $p = $each
    ->promise();
  $e = null;
  $received = null;
  $p
    ->then(null, function ($reason) use (&$e) {
    $e = $reason;
  });
  P\queue()
    ->run();
  $this
    ->assertInstanceOf('Exception', $e);
  $this
    ->assertEquals('Failure', $e
    ->getMessage());
}