Beispiel #1
0
 public function testAssemblingWithNonFirstHostname()
 {
     $this->markTestSkipped('Router features not ready');
     $foo = new Route\StaticRoute('bar');
     $bar = new Route\Hostname('www.zend.com');
     $foo->addChain($bar);
     $this->_router->addRoute('foo-bar', $foo);
     $this->assertEquals('bar/www.zend.com', $this->_router->assemble(array(), 'foo-bar'));
 }
Beispiel #2
0
 public function testChainingSeparatorOverriding()
 {
     $foo = new Route\StaticRoute('foo', array('foo' => 1));
     $bar = new Route\StaticRoute('bar', array('bar' => 2));
     $baz = new Route\StaticRoute('baz', array('baz' => 3));
     $chain = $foo->addChain($bar, '.');
     $res = $chain->match(new Request('http://localhost/foo.bar'));
     $this->assertType('array', $res);
     $res = $chain->match(new Request('http://localhost/foo/bar'));
     $this->assertEquals(false, $res);
     $chain->addChain($baz, ':');
     $res = $chain->match(new Request('http://localhost/foo.bar:baz'));
     $this->assertType('array', $res);
 }
Beispiel #3
0
    public function testGetInstance()
    {

        $routeConf = array(
            'route' => 'users/all',
            'defaults' => array(
                'controller' => 'ctrl'
            )
        );

        $config = new \Zend\Config\Config($routeConf);
        $route = Route\StaticRoute::getInstance($config);

        $this->assertType('Zend\Controller\Router\Route\StaticRoute', $route);

        $values = $route->match('users/all');

        $this->assertSame('ctrl', $values['controller']);

    }