コード例 #1
0
ファイル: RewriteTest.php プロジェクト: stunti/zf2
 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'));
 }
コード例 #2
0
ファイル: ChainTest.php プロジェクト: narixx/zf2
 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);
 }
コード例 #3
0
ファイル: StaticTest.php プロジェクト: niallmccrudden/zf2
    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']);

    }