Skip to content

Commit

Permalink
Renaming connectDefaults to defaults().
Browse files Browse the repository at this point in the history
Updating tests.
  • Loading branch information
markstory committed Nov 26, 2009
1 parent 636d944 commit 1d7881b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cake/libs/router.php
Expand Up @@ -314,13 +314,14 @@ function connectNamed($named, $options = array()) {

/**
* Tell router to connect or not connect the default routes.
*
* If default routes are disabled all automatic route generation will be disabled
* and you will need to manually configure all the routes you want.
*
* @param boolean $connect Set to true or false depending on whether you want or don't want default routes.
* @return void
*/
function connectDefaults($connect = true) {
function defaults($connect = true) {
$_this =& Router::getInstance();
$_this->__connectDefaults = $connect;
}
Expand Down
14 changes: 14 additions & 0 deletions cake/tests/cases/libs/router.test.php
Expand Up @@ -1965,6 +1965,20 @@ function testGetParams() {
$this->assertEqual(Router::getparams(), $expected);
$this->assertEqual(Router::getparams(true), $expected);
}

/**
* test that connectDefaults() can disable default route connection
*
* @return void
*/
function testRouterConnectDefaults() {
Router::defaults(false);
Router::connect('/test/*', array('controller' => 'pages', 'action' => 'display', 2));
$result = Router::parse('/posts/edit/5');
$this->assertFalse(isset($result['controller']));
$this->assertFalse(isset($result['action']));

}
}

/**
Expand Down

0 comments on commit 1d7881b

Please sign in to comment.