@@ -839,6 +839,30 @@ public function testMultipleChainsWithVersion2Routes()
839
839
$ this ->assertEquals ('chain2 ' , $ rewrite ->getCurrentRouteName (), 'Routing did not match expected route ' );
840
840
}
841
841
842
+ /**
843
+ * @throws Zend_Controller_Router_Exception
844
+ */
845
+ public function testMultipleChainsResettingPathInfoInSegmentBlock ()
846
+ {
847
+ $ foo = new Zend_Controller_Router_Route_SubclassTest ('notfoo ' );
848
+ $ bar = new Zend_Controller_Router_Route_SubclassTest ('bar ' , array ('baz ' => 'no ' ));
849
+
850
+
851
+ $ chain = $ foo ->chain ($ bar );
852
+
853
+ $ static = new Zend_Controller_Router_Route_SimpleSubclassTest ('/foo ' , array ('foo ' => 'foo ' ));
854
+
855
+ $ rewrite = new Zend_Controller_Router_Rewrite ();
856
+ $ rewrite ->addRoute ('static ' , $ static ); // First In Last Out, we want this to be matched against second
857
+ $ rewrite ->addRoute ('chain ' , $ chain );
858
+ $ request = new Zend_Controller_Router_ChainTest_Request ('http://www.zend.com/foo ' );
859
+
860
+ $ res = $ rewrite ->route ($ request );
861
+ $ this ->assertEquals ('foo ' , $ res ->getParam ('foo ' ), 'Route did not match ' );
862
+ $ this ->assertEquals ('static ' , $ rewrite ->getCurrentRouteName (), 'Routing did not match expected route ' );
863
+
864
+ }
865
+
842
866
/**
843
867
* @group ZF-11443
844
868
*/
@@ -958,13 +982,53 @@ protected function _getRouter()
958
982
}
959
983
}
960
984
985
+ class Zend_Controller_Router_Route_SimpleSubclassTest extends Zend_Controller_Router_Route_Abstract
986
+ {
987
+ /**
988
+ * @var string
989
+ */
990
+ protected $ path ;
991
+
992
+ /**
993
+ * @var array
994
+ */
995
+ protected $ params = array ();
996
+
997
+ public function __construct ($ path , $ params )
998
+ {
999
+ $ this ->path = $ path ;
1000
+ $ this ->params = $ params ;
1001
+ }
1002
+
1003
+ public function match ($ path , $ partial = false )
1004
+ {
1005
+ $ path = $ path ->getPathInfo ();
1006
+ if ($ path == $ this ->path ) {
1007
+ $ this ->setMatchedPath ($ this ->path );
1008
+ return $ this ->params ;
1009
+ }
1010
+ return false ;
1011
+ }
1012
+
1013
+ public function getVersion ()
1014
+ {
1015
+ return 2 ;
1016
+ }
1017
+
1018
+ public function assemble ($ data = array (), $ reset = false , $ encode = false )
1019
+ {}
1020
+
1021
+ public static function getInstance (Zend_Config $ config )
1022
+ {}
1023
+
1024
+ }
961
1025
962
1026
class Zend_Controller_Router_Route_SubclassTest extends Zend_Controller_Router_Route_Static
963
1027
{
964
1028
public function match ($ path , $ partial = false )
965
1029
{
966
1030
$ path = $ path ->getPathInfo ();
967
- $ match = parent ::match ($ path , $ partial ); // TODO: Change the autogenerated stub
1031
+ $ match = parent ::match ($ path , $ partial );
968
1032
if (is_array ($ match )) {
969
1033
$ this ->setMatchedPath ($ this ->_route );
970
1034
}
@@ -977,14 +1041,10 @@ public function getVersion()
977
1041
}
978
1042
979
1043
public function assemble ($ data = array (), $ reset = false , $ encode = false )
980
- {
981
- // TODO: Implement assemble() method.
982
- }
1044
+ {}
983
1045
984
1046
public static function getInstance (Zend_Config $ config )
985
- {
986
- // TODO: Implement getInstance() method.
987
- }
1047
+ {}
988
1048
989
1049
}
990
1050
0 commit comments