예제 #1
0
파일: RewriteTest.php 프로젝트: stunti/zf2
 public function testAssemblingWithHostnameWithChainHTTP()
 {
     $foo = new Route\Hostname('www.zend.com');
     $bar = new Route\StaticRoute('bar');
     $chain = $foo->addChain($bar);
     $this->_router->addRoute('foo-bar', $chain);
     $this->assertEquals('http://www.zend.com/bar', $this->_router->assemble(array(), 'foo-bar'));
 }
예제 #2
0
파일: ChainTest.php 프로젝트: narixx/zf2
 public function testChainingWorksWithWildcardAndOneParameter()
 {
     $foo = new Route\Hostname('www.zend.com', array('module' => 'simple', 'controller' => 'foo', 'action' => 'bar'));
     $bar = new Route\Route(':controller/:action/*', array('controller' => 'index', 'action' => 'index'));
     $chain = $foo->addChain($bar);
     $request = new Request('http://www.zend.com/foo/bar/id/12');
     $res = $chain->match($request);
     $this->assertEquals('simple', $res['module']);
     $this->assertEquals('foo', $res['controller']);
     $this->assertEquals('bar', $res['action']);
 }
예제 #3
0
 public function testForcedSchemeAssembling()
 {
     $request = new Stub('www.zend.com');
     $route = new Route\Hostname('www.zend.com', array('controller' => 'host-foo', 'action' => 'host-bar'), array(), 'https');
     $route->setRequest($request);
     $url = $route->assemble();
     $this->assertEquals('https://www.zend.com', $url);
 }