public function testPath() { $r = new Router($this->container); $this->assertEquals('a/b/c', $r->getPath('/a/b/c')); $this->assertEquals('a/b/something', $r->getPath('/a/b/something?test=a', 'test=a')); $_SERVER['REQUEST_METHOD'] = 'GET'; $_SERVER['PHP_SELF'] = '/a/index.php'; $this->assertEquals('b/c', $r->getPath('/a/b/c')); $this->assertEquals('b/c', $r->getPath('/a/b/c?e=f', 'e=f')); }
public function testGetPath() { $dispatcher = new Router($this->container); $this->container['helper'] = new Helper($this->container); $this->container['request'] = new Request($this->container, array('PHP_SELF' => '/index.php', 'REQUEST_URI' => '/a/b/c', 'REQUEST_METHOD' => 'GET')); $this->assertEquals('a/b/c', $dispatcher->getPath()); $this->container['helper'] = new Helper($this->container); $this->container['request'] = new Request($this->container, array('PHP_SELF' => '/index.php', 'REQUEST_URI' => '/a/b/something?test=a', 'QUERY_STRING' => 'test=a', 'REQUEST_METHOD' => 'GET')); $this->assertEquals('a/b/something', $dispatcher->getPath()); $this->container['helper'] = new Helper($this->container); $this->container['request'] = new Request($this->container, array('PHP_SELF' => '/a/index.php', 'REQUEST_URI' => '/a/b/something?test=a', 'QUERY_STRING' => 'test=a', 'REQUEST_METHOD' => 'GET')); $this->assertEquals('b/something', $dispatcher->getPath()); }
public function testGetPathWithSubFolderAndQueryString() { $router = new Router($this->container); $this->container['request'] = new Request($this->container, array('PHP_SELF' => '/a/index.php', 'REQUEST_URI' => '/a/b/something?test=a', 'QUERY_STRING' => 'test=a', 'REQUEST_METHOD' => 'GET')); $this->assertEquals('b/something', $router->getPath()); }