Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Test error middleware handling against throwables as well as exceptions
Browse files Browse the repository at this point in the history
- per @Ocramius
  • Loading branch information
weierophinney committed Jan 5, 2017
1 parent 0a88ee2 commit eefbe51
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/DispatchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,20 @@ public function testInvokingWithInteropMiddlewareDispatchesIt()
);
}

public function testInvokingWithMiddlewarePipeAndErrorDispatchesNextErrorMiddleware()
public function errorProvider()
{
yield 'exception' => [new \Exception('expected')];
yield 'derivative-exception' => [new RuntimeException('expected')];
if (version_compare(\PHP_VERSION, '7.0', 'gte')) {
yield 'throwable' => [new \Error('expected')];
}
}

/**
* @dataProvider errorProvider
*/
public function testInvokingWithMiddlewarePipeAndErrorDispatchesNextErrorMiddleware($error)
{
$error = new RuntimeException('expected');
$request = $this->prophesize(ServerRequestInterface::class)->reveal();
$response = $this->prophesize(ResponseInterface::class)->reveal();
$expected = $this->prophesize(ResponseInterface::class)->reveal();
Expand Down

0 comments on commit eefbe51

Please sign in to comment.