Removing dead test case, its covered by the CakeRoute tests.

This commit is contained in:
Mark Story 2009-12-08 23:10:51 -05:00
parent 6b657d9a9d
commit f8a406e9fa

View file

@ -76,78 +76,6 @@ class RouterTest extends CakeTestCase {
$this->assertPattern('/^http(s)?:\/\//', Router::url(null, true));
}
/**
* testRouteWriting method
*
* @access public
* @return void
*/
function testRouteWriting() {
return false;
Router::connect('/');
Router::parse('/');
$this->assertEqual($this->router->routes[0][0], '/');
$this->assertEqual($this->router->routes[0][1], '/^[\/]*$/');
$this->assertEqual($this->router->routes[0][2], array());
Router::reload();
Router::connect('/', array('controller' => 'testing'));
Router::parse('/');
$this->assertTrue(is_array($this->router->routes[0][3]) && !empty($this->router->routes[0][3]));
$this->assertEqual($this->router->routes[0][3]['controller'], 'testing');
$this->assertEqual($this->router->routes[0][3]['action'], 'index');
$this->assertEqual(count($this->router->routes[0][3]), 3);
$this->router->routes = array();
Router::connect('/:controller', array('controller' => 'testing2'));
Router::parse('/testing2');
$this->assertTrue(is_array($this->router->routes[0][3]) && !empty($this->router->routes[0][3]), '/');
$this->assertEqual($this->router->routes[0][3]['controller'], 'testing2');
$this->assertEqual($this->router->routes[0][3]['action'], 'index');
$this->assertEqual(count($this->router->routes[0][3]), 3);
$this->router->routes = array();
Router::connect('/:controller/:action', array('controller' => 'testing3'));
Router::parse('/testing3/index');
$this->assertEqual($this->router->routes[0][0], '/:controller/:action');
$this->assertEqual($this->router->routes[0][1], '#^(?:/([^\/]+))?(?:/([^\/]+))?[\/]*$#');
$this->assertEqual($this->router->routes[0][2], array('controller', 'action'));
$this->assertEqual($this->router->routes[0][3], array('controller' => 'testing3', 'action' => 'index', 'plugin' => null));
$this->router->routes = array();
Router::connect('/:controller/:action/:id', array('controller' => 'testing4', 'id' => null), array('id' => $this->router->__named['ID']));
Router::parse('/testing4/view/5');
$this->assertEqual($this->router->routes[0][0], '/:controller/:action/:id');
$this->assertEqual($this->router->routes[0][1], '#^(?:/([^\/]+))?(?:/([^\/]+))?(?:/([0-9]+)?)?[\/]*$#');
$this->assertEqual($this->router->routes[0][2], array('controller', 'action', 'id'));
$this->router->routes = array();
Router::connect('/:controller/:action/:id', array('controller' => 'testing4'), array('id' => $this->router->__named['ID']));
Router::parse('/testing4/view/5');
$this->assertEqual($this->router->routes[0][1], '#^(?:/([^\/]+))?(?:/([^\/]+))?(?:/([0-9]+))[\/]*$#');
$this->router->routes = array();
Router::connect('/posts/foo:id');
Router::parse('/posts/foo5');
$this->assertEqual($this->router->routes[0][2], array('id'));
$this->assertEqual($this->router->routes[0][1], '#^/posts(?:/foo([^\/]+))?[\/]*$#');
foreach (array(':', '@', ';', '$', '-') as $delim) {
$this->router->routes = array();
Router::connect('/posts/:id'.$delim.':title');
Router::parse('/posts/5' . $delim . 'foo');
$this->assertEqual($this->router->routes[0][2], array('id', 'title'));
$this->assertEqual($this->router->routes[0][1], '#^/posts(?:/([^\/]+))?(?:'.preg_quote($delim, '#').'([^\/]+))?[\/]*$#');
}
$this->router->routes = array();
Router::connect('/posts/:id::title/:year');
Router::parse('/posts/5:foo:2007');
$this->assertEqual($this->router->routes[0][2], array('id', 'title', 'year'));
$this->assertEqual($this->router->routes[0][1], '#^/posts(?:/([^\/]+))?(?:\\:([^\/]+))?(?:/([^\/]+))?[\/]*$#');
}
/**
* testRouteDefaultParams method
*