OrnoTest\Route\DispatcherTest::testDispatcherHandles405CorrectlyOnRestfulStrategy PHP Method

testDispatcherHandles405CorrectlyOnRestfulStrategy() public method

Asserts that a 405 response is returned whilst using restful strategy
    public function testDispatcherHandles405CorrectlyOnRestfulStrategy()
    {
        $collection = new Route\RouteCollection();
        $collection->setStrategy(Route\RouteStrategyInterface::RESTFUL_STRATEGY);
        $collection->post('/route', 'handler');
        $collection->put('/route', 'handler');
        $collection->delete('/route', 'handler');
        $dispatcher = $collection->getDispatcher();
        $response = $dispatcher->dispatch('GET', '/route');
        $this->assertInstanceOf('Orno\\Http\\JsonResponse', $response);
        $this->assertSame('{"status_code":405,"message":"Method Not Allowed"}', $response->getContent());
        $this->assertSame(405, $response->getStatusCode());
        $this->assertTrue($response->headers->has('Allow'));
        $this->assertSame('POST, PUT, DELETE', $response->headers->get('Allow'));
    }