Beispiel #1
0
 public function testVariableUnsettingRegex()
 {
     $foo = new Route\Regex('([^/]+)', array(), array(1 => 'foo'), '%s');
     $bar = new Route\Module(array('controller' => 'ctrl', 'action' => 'act'));
     $chain = $foo->addChain($bar);
     $path = $chain->assemble(array('foo' => 'bar', 'baz' => 'bat'));
     $this->assertEquals('bar/ctrl/act/baz/bat', $path);
 }
Beispiel #2
0
 /**
  * Allow using <lang>1</lang> instead of invalid <1>lang</1> for xml router
  * config.
  *
  * <zend-config>
  *     <routes>
  *         <page>
  *             <type>Zend_Controller_Router_Route_Regex</type>
  *             <route>([a-z]{2})/page/(.*)</route>
  *             <defaults>
  *                 <controller>index</controller>
  *                 <action>showpage</action>
  *             </defaults>
  *             <map>
  *                 <lang>1</lang>
  *                 <title>2</title>
  *             </map>
  *             <reverse>%s/page/%s</reverse>
  *         </page>
  *     </routes>
  * </zend-config>
  *
  *
  * @group ZF-7658
  */
 public function testAssembleWithFlippedMappedVariables()
 {
     $route = new Route\Regex('([a-z]{2})/page/(.*)', array('controller' => 'index', 'action' => 'showpage'), array('lang' => 1, 'title' => 2), '%s/page/%s');
     $url = $route->assemble(array('lang' => 'fi', 'title' => 'Suomi'), true, true);
     $this->assertEquals($url, 'fi/page/Suomi');
 }