From 1d7881b16f2898e03c65dcd68f4ef9faf54e8c64 Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 25 Nov 2009 23:39:07 -0500 Subject: [PATCH] Renaming connectDefaults to defaults(). Updating tests. --- cake/libs/router.php | 3 ++- cake/tests/cases/libs/router.test.php | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cake/libs/router.php b/cake/libs/router.php index 00d5f565553..2135c979bf7 100644 --- a/cake/libs/router.php +++ b/cake/libs/router.php @@ -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; } diff --git a/cake/tests/cases/libs/router.test.php b/cake/tests/cases/libs/router.test.php index b5ccd8fa5e5..387aa7d1388 100644 --- a/cake/tests/cases/libs/router.test.php +++ b/cake/tests/cases/libs/router.test.php @@ -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'])); + + } } /**