/** * Return routes that match the current request * @return array[Slim_Route] */ public function getMatchedRoutes($reload = false) { if ($reload || is_null($this->matchedRoutes)) { $this->matchedRoutes = array(); $method = $this->request->isHead() ? Slim_Http_Request::METHOD_GET : $this->request->getMethod(); foreach ($this->routes[$method] as $route) { if ($route->matches($this->request->getResourceUri())) { $this->matchedRoutes[] = $route; } } } return $this->matchedRoutes; }
/** * Test sets HTTP method */ public function testGetMethod() { $env = Slim_Environment::mock(array('REQUEST_METHOD' => 'GET')); $req = new Slim_Http_Request($env); $this->assertEquals('GET', $req->getMethod()); }
/** * Test sets HTTP method */ public function testGetMethod() { $env = Slim_Environment::getInstance(); $req = new Slim_Http_Request($env); $this->assertEquals('GET', $req->getMethod()); }
public function testGetMethod() { $_SERVER['REQUEST_METHOD'] = 'POST'; $r = new Slim_Http_Request(); $this->assertEquals($_SERVER['REQUEST_METHOD'], $r->getMethod()); }