示例#1
0
 /**
  *
  */
 public function testRouteRegistration2()
 {
     $routes = new Routes();
     $routes->get('/foo', 'FooController::fooAction');
     $routes->post('/foo', 'FooController::fooAction');
     $routes->put('/foo', 'FooController::fooAction');
     $routes->patch('/foo', 'FooController::fooAction');
     $routes->delete('/foo', 'FooController::fooAction');
     $routes->all('/foo', 'FooController::fooAction');
     $routes->register(['OPTIONS', 'HEAD'], '/foo', 'FooController::fooAction');
     $routes = $routes->getRoutes();
     $this->assertEquals(['GET', 'HEAD', 'OPTIONS'], $routes[0]->getMethods());
     $this->assertEquals(['POST', 'OPTIONS'], $routes[1]->getMethods());
     $this->assertEquals(['PUT', 'OPTIONS'], $routes[2]->getMethods());
     $this->assertEquals(['PATCH', 'OPTIONS'], $routes[3]->getMethods());
     $this->assertEquals(['DELETE', 'OPTIONS'], $routes[4]->getMethods());
     $this->assertEquals(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'], $routes[5]->getMethods());
     $this->assertEquals(['OPTIONS', 'HEAD'], $routes[6]->getMethods());
 }