|
|
@@ -815,6 +815,30 @@ class Zend_Controller_Router_Route_ChainTest extends PHPUnit_Framework_TestCase
|
|
|
$this->assertEquals(2, $res['bar']);
|
|
|
}
|
|
|
|
|
|
+ public function testMultipleChainsWithVersion2Routes()
|
|
|
+ {
|
|
|
+
|
|
|
+ $foo = new Zend_Controller_Router_Route_SubclassTest('foo');
|
|
|
+ $bar = new Zend_Controller_Router_Route_SubclassTest('bar', array('baz' => 'no'));
|
|
|
+
|
|
|
+
|
|
|
+ $chain = $foo->chain($bar);
|
|
|
+
|
|
|
+ $foo2 = new Zend_Controller_Router_Route_SubclassTest('foo');
|
|
|
+ $baz = new Zend_Controller_Router_Route_SubclassTest('baz', array('baz' => 'baz'));
|
|
|
+
|
|
|
+ $chain2 = $foo2->chain($baz);
|
|
|
+
|
|
|
+ $rewrite = new Zend_Controller_Router_Rewrite();
|
|
|
+ $rewrite->addRoute('chain2', $chain2); // First In Last Out, we want this to be matched against second
|
|
|
+ $rewrite->addRoute('chain1', $chain);
|
|
|
+ $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/foo/baz');
|
|
|
+
|
|
|
+ $res = $rewrite->route($request);
|
|
|
+ $this->assertEquals('baz', $res->getParam('baz'), 'Route did not match');
|
|
|
+ $this->assertEquals('chain2', $rewrite->getCurrentRouteName(), 'Routing did not match expected route');
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @group ZF-11443
|
|
|
*/
|
|
|
@@ -934,6 +958,36 @@ class Zend_Controller_Router_Route_ChainTest extends PHPUnit_Framework_TestCase
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+class Zend_Controller_Router_Route_SubclassTest extends Zend_Controller_Router_Route_Static
|
|
|
+{
|
|
|
+ public function match($path, $partial = false)
|
|
|
+ {
|
|
|
+ $path = $path->getPathInfo();
|
|
|
+ $match = parent::match($path, $partial); // TODO: Change the autogenerated stub
|
|
|
+ if (is_array($match)) {
|
|
|
+ $this->setMatchedPath($this->_route);
|
|
|
+ }
|
|
|
+ return $match;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getVersion()
|
|
|
+ {
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function assemble($data = array(), $reset = false, $encode = false)
|
|
|
+ {
|
|
|
+ // TODO: Implement assemble() method.
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function getInstance(Zend_Config $config)
|
|
|
+ {
|
|
|
+ // TODO: Implement getInstance() method.
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Zend_Controller_Router_ChainTest_Request - request object for router testing
|
|
|
*
|