public function testRewriteBaseWithFakeIndexAtRoot() { $_SERVER['DOCUMENT_ROOT'] = '/var/www/localhost/htdocs'; $_SERVER['SCRIPT_FILENAME'] = '/var/www/localhost/htdocs/test/index.php'; $_SERVER['REQUEST_URI'] = '/archive/2006/05/index.php'; $_SERVER['SCRIPT_NAME'] = '/index.php'; $_SERVER['PATH_INFO'] = '/archive/2006/05/index.php'; // Redundant to setUp $router = new Zend_Controller_RewriteRouter(); $rwBase = $router->detectRewriteBase(); $this->assertSame('', $rwBase); }
public function testRewriteBaseDeepUrlWithoutRewrite() { $_SERVER['SCRIPT_NAME'] = '/aiev5/www/index.php'; $_SERVER['REQUEST_URI'] = '/aiev5/www/index.php/publish/article'; // Redundant to setUp $router = new Zend_Controller_RewriteRouter(); $rwBase = $router->getRewriteBase(); $this->assertEquals('/aiev5/www/index.php', $rwBase); }
public function testFirstRouteMatched() { $router = new Zend_Controller_RewriteRouter(); $request = new Zend_Controller_RewriteRouterTest_Request('http://localhost/archive/2006'); $router->addRoute('archive', new Zend_Controller_Router_Route('archive/:year', array('year' => '2006', 'controller' => 'archive', 'action' => 'show'), array('year' => '\\d+'))); $router->addRoute('register', new Zend_Controller_Router_Route('register/:action', array('controller' => 'profile', 'action' => 'register'))); $token = $router->route($request); $this->assertSame('archive', $token->getControllerName()); $this->assertSame('show', $token->getActionName()); }