示例#1
0
 function testMethods()
 {
     $route = new Route('/path', '');
     $this->assertEquals([], $route->getMethods());
     $route->setMethods(['get']);
     $this->assertEquals(['get'], $route->getMethods());
 }
示例#2
0
 function testMethodNotAllowedException()
 {
     $routes = new RouteCollection();
     $route = new Route('/foo/{id}/bar/{name}', '');
     $route->setMethods(['POST', 'PUT']);
     $routes->add($route);
     $context = RequestContext::create();
     $this->assertEquals(['post', 'put'], $route->getMethods());
     $this->assertEquals('GET', $context->getMethod());
     $matcher = new Matcher($context);
     $this->setExpectedExceptionRegExp('Slince\\Routing\\Exception\\MethodNotAllowedException');
     $matcher->match('/foo/100/bar/steven', $routes);
 }