Exemple #1
0
 /**
  * @inheritdoc
  */
 public function assemble(array $params = array(), array $options = array())
 {
     foreach ($params as $key => &$value) {
         if (in_array($key, $this->_hashidsParams)) {
             $value = $this->_encode($value);
         }
     }
     return parent::assemble($params, $options);
 }
Exemple #2
0
 public function testAssemblingWithMissingParameterInRoot()
 {
     $this->setExpectedException('Zend\\Mvc\\Router\\Exception\\InvalidArgumentException', 'Missing parameter "foo"');
     $route = new Segment(':foo');
     $route->assemble();
 }
Exemple #3
0
 public function testAssemblingWithExistingChild()
 {
     $route = new Segment('/[:foo]', array(), array('foo' => 'bar'));
     $path = $route->assemble(array(), array('has_child' => true));
     $this->assertEquals('/bar', $path);
 }
Exemple #4
0
 public function testEncodeCache()
 {
     $params1 = array('p1' => 6.123, 'p2' => 7);
     $uri1 = 'example.com/' . join('/', $params1);
     $params2 = array('p1' => 6, 'p2' => 'test');
     $uri2 = 'example.com/' . join('/', $params2);
     $route = new Segment('example.com/:p1/:p2');
     $request = new Request();
     $request->setUri($uri1);
     $route->match($request);
     $this->assertSame($uri1, $route->assemble($params1));
     $request->setUri($uri2);
     $route->match($request);
     $this->assertSame($uri2, $route->assemble($params2));
 }