Exemplo n.º 1
0
 /**
  * Create a new chain
  *
  * @param  \Zend\Controller\Router\Route\AbstractRoute $route
  * @param  string                                $separator
  * @return \Zend\Controller\Router\Route\Chain
  */
 public function addChain(AbstractRoute $route, $separator = '/')
 {
     $chain = new Chain();
     $chain->addChain($this)->addChain($route, $separator);
     return $chain;
 }
Exemplo n.º 2
0
 public function testChainingAssembleWithRegex()
 {
     $chain = new Route\Chain();
     $foo = new Route\Hostname('www.zend.com', array('foo' => 'foo'));
     $bar = new Route\Regex('bar', array('bar' => 'bar'), array(), 'bar');
     $chain->addChain($foo)->addChain($bar);
     $request = new Request('http://www.zend.com/bar');
     $res = $chain->match($request);
     $this->assertType('array', $res);
     $this->assertRegexp('#[^a-z0-9]?www\\.zend\\.com/bar$#i', $chain->assemble());
 }
Exemplo n.º 3
0
 public function testAssemblingWithHostnameThroughChainHTTP()
 {
     $foo = new Route\Hostname('www.zend.com');
     $bar = new Route\StaticRoute('bar');
     $chain = new Route\Chain();
     $chain->addChain($foo)->addChain($bar);
     $this->_router->addRoute('foo-bar', $chain);
     $this->assertEquals('http://www.zend.com/bar', $this->_router->assemble(array(), 'foo-bar'));
 }