OrnoTest\Route\RouteCollectionTest::testSetsRoutesViaConvenienceMethods PHP Méthode

testSetsRoutesViaConvenienceMethods() public méthode

Asserts that routes are set via convenience methods
    public function testSetsRoutesViaConvenienceMethods()
    {
        $router = new RouteCollection();
        $router->get('/route/{wildcard}', 'handler_get', RouteCollection::RESTFUL_STRATEGY);
        $router->post('/route/{wildcard}', 'handler_post', RouteCollection::URI_STRATEGY);
        $router->put('/route/{wildcard}', 'handler_put', RouteCollection::REQUEST_RESPONSE_STRATEGY);
        $router->patch('/route/{wildcard}', 'handler_patch');
        $router->delete('/route/{wildcard}', 'handler_delete');
        $router->head('/route/{wildcard}', 'handler_head');
        $router->options('/route/{wildcard}', 'handler_options');
        $routes = (new \ReflectionClass($router))->getProperty('routes');
        $routes->setAccessible(true);
        $routes = $routes->getValue($router);
        $this->assertCount(7, $routes);
        $this->assertSame($routes['handler_get'], ['strategy' => 1]);
        $this->assertSame($routes['handler_post'], ['strategy' => 2]);
        $this->assertSame($routes['handler_put'], ['strategy' => 0]);
        $this->assertSame($routes['handler_patch'], ['strategy' => 0]);
        $this->assertSame($routes['handler_delete'], ['strategy' => 0]);
        $this->assertSame($routes['handler_head'], ['strategy' => 0]);
        $this->assertSame($routes['handler_options'], ['strategy' => 0]);
    }