OrnoTest\Route\DispatcherTest::testRestfulStrategyRouteThrowsExceptionWhenWrongResponseReturned PHP Метод

testRestfulStrategyRouteThrowsExceptionWhenWrongResponseReturned() публичный Метод

Assert that a route using Restful Strategy throws exception for wrong response type
    public function testRestfulStrategyRouteThrowsExceptionWhenWrongResponseReturned()
    {
        $this->setExpectedException('RuntimeException', 'Your controller action must return a valid response for the Restful Strategy. Acceptable responses are of type: [Array], [ArrayObject] and [Orno\\Http\\JsonResponse]');
        $collection = new Route\RouteCollection();
        $collection->setStrategy(Route\RouteStrategyInterface::RESTFUL_STRATEGY);
        $collection->get('/route', function ($response) {
            return new \stdClass();
        });
        $dispatcher = $collection->getDispatcher();
        $response = $dispatcher->dispatch('GET', '/route');
    }