/** * Asserts that global strategy is used when set * * @return void */ public function testGlobalStrategyIsUsedWhenSet() { $router = new RouteCollection(); $router->setStrategy(RouteCollection::URI_STRATEGY); $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' => 2]); $this->assertSame($routes['handler_post'], ['strategy' => 2]); $this->assertSame($routes['handler_put'], ['strategy' => 2]); $this->assertSame($routes['handler_patch'], ['strategy' => 2]); $this->assertSame($routes['handler_delete'], ['strategy' => 2]); $this->assertSame($routes['handler_head'], ['strategy' => 2]); $this->assertSame($routes['handler_options'], ['strategy' => 2]); }