Exemplo n.º 1
0
 /**
  * test numerically indexed defaults, get appended to pass
  *
  * @return void
  */
 public function testParseWithPassDefaults()
 {
     $route = new Cakeroute('/:controller', array('action' => 'display', 'home'));
     $result = $route->parse('/posts');
     $expected = array('controller' => 'posts', 'action' => 'display', 'pass' => array('home'), 'named' => array());
     $this->assertEquals($expected, $result);
 }
 /**
  * test the parse method of CakeRoute.
  *
  * @return void
  */
 function testParse()
 {
     $route = new CakeRoute('/:controller/:action/:id', array('controller' => 'testing4', 'id' => null), array('id' => Router::ID));
     $route->compile();
     $result = $route->parse('/posts/view/1');
     $this->assertEqual($result['controller'], 'posts');
     $this->assertEqual($result['action'], 'view');
     $this->assertEqual($result['id'], '1');
     $route = new Cakeroute('/admin/:controller', array('prefix' => 'admin', 'admin' => 1, 'action' => 'index'));
     $route->compile();
     $result = $route->parse('/admin/');
     $this->assertFalse($result);
     $result = $route->parse('/admin/posts');
     $this->assertEqual($result['controller'], 'posts');
     $this->assertEqual($result['action'], 'index');
 }