Skip to content

Commit

Permalink
Removing dead test case, its covered by the CakeRoute tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 9, 2009
1 parent 6b657d9 commit f8a406e
Showing 1 changed file with 0 additions and 72 deletions.
72 changes: 0 additions & 72 deletions cake/tests/cases/libs/router.test.php
Expand Up @@ -76,78 +76,6 @@ function testFullBaseURL() {
$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
*
Expand Down

0 comments on commit f8a406e

Please sign in to comment.