|
|
@@ -611,6 +611,36 @@ class Zend_Controller_Router_Route_ChainTest extends PHPUnit_Framework_TestCase
|
|
|
$this->assertType('Zend_Controller_Router_Route_Chain', $router->getRoute('www-index'));
|
|
|
}
|
|
|
|
|
|
+ public function testChainingWorksWithWildcardAndNoParameters()
|
|
|
+ {
|
|
|
+ $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('module' => 'simple', 'controller' => 'bar', 'action' => 'bar'));
|
|
|
+ $bar = new Zend_Controller_Router_Route(':controller/:action/*', array('controller' => 'index', 'action' => 'index'));
|
|
|
+
|
|
|
+ $chain = $foo->chain($bar);
|
|
|
+
|
|
|
+ $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/foo/bar/');
|
|
|
+ $res = $chain->match($request);
|
|
|
+
|
|
|
+ $this->assertEquals('simple', $res['module']);
|
|
|
+ $this->assertEquals('foo', $res['controller']);
|
|
|
+ $this->assertEquals('bar', $res['action']);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testChainingWorksWithWildcardAndOneParameter()
|
|
|
+ {
|
|
|
+ $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('module' => 'simple', 'controller' => 'foo', 'action' => 'bar'));
|
|
|
+ $bar = new Zend_Controller_Router_Route(':controller/:action/*', array('controller' => 'index', 'action' => 'index'));
|
|
|
+
|
|
|
+ $chain = $foo->chain($bar);
|
|
|
+
|
|
|
+ $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/foo/bar/id/12');
|
|
|
+ $res = $chain->match($request);
|
|
|
+
|
|
|
+ $this->assertEquals('simple', $res['module']);
|
|
|
+ $this->assertEquals('foo', $res['controller']);
|
|
|
+ $this->assertEquals('bar', $res['action']);
|
|
|
+ }
|
|
|
+
|
|
|
protected function _getRouter()
|
|
|
{
|
|
|
$router = new Zend_Controller_Router_Rewrite();
|