コード例 #1
0
ファイル: RouterTest.php プロジェクト: redarrow/kanboard
 public function testFindUrl()
 {
     $r = new Router($this->container);
     $r->addRoute('a/b', 'controller1', 'action1');
     $r->addRoute('a/:myvar1/b/:myvar2', 'controller2', 'action2', array('myvar1', 'myvar2'));
     $this->assertEquals('a/1/b/2', $r->findUrl('controller2', 'action2', array('myvar1' => 1, 'myvar2' => 2)));
     $this->assertEquals('', $r->findUrl('controller2', 'action2', array('myvar1' => 1)));
     $this->assertEquals('a/b', $r->findUrl('controller1', 'action1'));
     $this->assertEquals('', $r->findUrl('controller1', 'action2'));
 }