diff --git a/src/Event/HttpFlowEvent.php b/src/Event/HttpFlowEvent.php index 0470763..9aab10e 100644 --- a/src/Event/HttpFlowEvent.php +++ b/src/Event/HttpFlowEvent.php @@ -45,8 +45,8 @@ class HttpFlowEvent extends Event public function __construct($name, $request, $response) { $this->setName($name); - $this->response = $response; - $this->request = $request; + $this->setRequest($request); + $this->setResponse($response); } /** diff --git a/tests/DispatcherTest.php b/tests/DispatcherTest.php index 191a801..4dc9d99 100644 --- a/tests/DispatcherTest.php +++ b/tests/DispatcherTest.php @@ -54,4 +54,21 @@ public function testDispatchMethodNotAllowedRequest() $dispatcher = new Dispatcher($this->router); $dispatcher->dispatch($request); } + + public function testDispatchGot500Exception() + { + $this->setExpectedException('Exception'); + + $router = $this->prophesize('FastRoute\Dispatcher'); + $request = (new Request()) + ->withUri(new Uri('/')) + ->withMethod('POST'); + + $router->dispatch('POST', '/')->willReturn([ + 0 => 3 + ])->shouldBeCalled(); + + $dispatcher = new Dispatcher($router->reveal()); + $dispatcher->dispatch($request); + } }