|
@@ -840,6 +840,30 @@ class Zend_Controller_Router_Route_ChainTest extends PHPUnit_Framework_TestCase
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * @throws Zend_Controller_Router_Exception
|
|
|
|
|
+ */
|
|
|
|
|
+ public function testMultipleChainsResettingPathInfoInSegmentBlock()
|
|
|
|
|
+ {
|
|
|
|
|
+ $foo = new Zend_Controller_Router_Route_SubclassTest('notfoo');
|
|
|
|
|
+ $bar = new Zend_Controller_Router_Route_SubclassTest('bar', array('baz' => 'no'));
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ $chain = $foo->chain($bar);
|
|
|
|
|
+
|
|
|
|
|
+ $static = new Zend_Controller_Router_Route_SimpleSubclassTest('/foo', array('foo' => 'foo'));
|
|
|
|
|
+
|
|
|
|
|
+ $rewrite = new Zend_Controller_Router_Rewrite();
|
|
|
|
|
+ $rewrite->addRoute('static', $static); // First In Last Out, we want this to be matched against second
|
|
|
|
|
+ $rewrite->addRoute('chain', $chain);
|
|
|
|
|
+ $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/foo');
|
|
|
|
|
+
|
|
|
|
|
+ $res = $rewrite->route($request);
|
|
|
|
|
+ $this->assertEquals('foo', $res->getParam('foo'), 'Route did not match');
|
|
|
|
|
+ $this->assertEquals('static', $rewrite->getCurrentRouteName(), 'Routing did not match expected route');
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* @group ZF-11443
|
|
* @group ZF-11443
|
|
|
*/
|
|
*/
|
|
|
public function testGetDefault()
|
|
public function testGetDefault()
|
|
@@ -958,6 +982,46 @@ class Zend_Controller_Router_Route_ChainTest extends PHPUnit_Framework_TestCase
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+class Zend_Controller_Router_Route_SimpleSubclassTest extends Zend_Controller_Router_Route_Abstract
|
|
|
|
|
+{
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @var string
|
|
|
|
|
+ */
|
|
|
|
|
+ protected $path;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @var array
|
|
|
|
|
+ */
|
|
|
|
|
+ protected $params = array();
|
|
|
|
|
+
|
|
|
|
|
+ public function __construct($path, $params)
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->path = $path;
|
|
|
|
|
+ $this->params = $params;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function match($path, $partial = false)
|
|
|
|
|
+ {
|
|
|
|
|
+ $path = $path->getPathInfo();
|
|
|
|
|
+ if ($path == $this->path) {
|
|
|
|
|
+ $this->setMatchedPath($this->path);
|
|
|
|
|
+ return $this->params;
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function getVersion()
|
|
|
|
|
+ {
|
|
|
|
|
+ return 2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function assemble($data = array(), $reset = false, $encode = false)
|
|
|
|
|
+ {}
|
|
|
|
|
+
|
|
|
|
|
+ public static function getInstance(Zend_Config $config)
|
|
|
|
|
+ {}
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
class Zend_Controller_Router_Route_SubclassTest extends Zend_Controller_Router_Route_Static
|
|
class Zend_Controller_Router_Route_SubclassTest extends Zend_Controller_Router_Route_Static
|
|
|
{
|
|
{
|