mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-03 01:52:40 +00:00
Renaming connectDefaults to defaults().
Updating tests.
This commit is contained in:
parent
636d944e70
commit
1d7881b16f
2 changed files with 16 additions and 1 deletions
|
@ -314,13 +314,14 @@ class Router {
|
|||
|
||||
/**
|
||||
* 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 @@ class RouterTest extends CakeTestCase {
|
|||
$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']));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue