Permalink
Browse files

Renaming connectDefaults to defaults().

Updating tests.
  • Loading branch information...
1 parent 636d944 commit 1d7881b16f2898e03c65dcd68f4ef9faf54e8c64 @markstory markstory committed Nov 26, 2009
Showing with 16 additions and 1 deletion.
  1. +2 −1 cake/libs/router.php
  2. +14 −0 cake/tests/cases/libs/router.test.php
View
@@ -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;
}
@@ -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']));
+
+ }
}
/**

0 comments on commit 1d7881b

Please sign in to comment.