OrnoTest\Route\DispatcherTest::testRequestResponseStrategyRouteThrowsExceptionWhenWrongResponseReturned PHP Méthode

testRequestResponseStrategyRouteThrowsExceptionWhenWrongResponseReturned() public méthode

Assert that a route using the Request -> Response Strategy throws exception when correct response not returned
    public function testRequestResponseStrategyRouteThrowsExceptionWhenWrongResponseReturned()
    {
        $this->setExpectedException('RuntimeException', 'When using the Request -> Response Strategy your controller must return an instance of [Orno\\Http\\ResponseInterface]');
        $collection = new Route\RouteCollection();
        $collection->setStrategy(Route\RouteStrategyInterface::REQUEST_RESPONSE_STRATEGY);
        $collection->get('/route', function (Request $request, Response $response) {
            $this->assertInstanceOf('Orno\\Http\\RequestInterface', $request);
            $this->assertInstanceOf('Orno\\Http\\ResponseInterface', $response);
            return [];
        });
        $dispatcher = $collection->getDispatcher();
        $response = $dispatcher->dispatch('GET', '/route');
    }