Skip to content

Commit

Permalink
Merge pull request #233 from clue-labs/unhandled-rejections
Browse files Browse the repository at this point in the history
Update test suite to avoid unhandled promise rejections
  • Loading branch information
SimonFrings authored Jul 10, 2023
2 parents f7bf6ee + 72214fb commit 3b10f71
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/Io/FiberHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,15 @@ public function testInvokeWithHandlerReturningGeneratorReturningResponseAfterYie
}
});

/** @var \Generator $generator */
$this->assertInstanceOf(\Generator::class, $generator);
$generator->throw(new \RuntimeException('Foo'));
assert($generator instanceof \Generator);
$promise = $generator->current();

assert($promise instanceof PromiseInterface);
$promise->then(null, function (\Throwable $e) use ($generator) {
$generator->throw($e);
});

assert(!$generator->valid());
$ret = $generator->getReturn();

$this->assertSame($response, $ret);
Expand Down

0 comments on commit 3b10f71

Please sign in to comment.