mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Adding test cases for Routing.prefixes.
This commit is contained in:
parent
3904c6f7b5
commit
3e394f1fa8
2 changed files with 26 additions and 1 deletions
|
@ -186,7 +186,7 @@ class Router {
|
|||
$this->__prefixes[] = $this->__admin = $routing['admin'];
|
||||
}
|
||||
if (isset($routing['prefixes'])) {
|
||||
$this->__prefixes = array_merge($this->__prefixes, $routing['prefixes']);
|
||||
$this->__prefixes = array_merge($this->__prefixes, (array)$routing['prefixes']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -1017,6 +1017,31 @@ class RouterTest extends CakeTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that Routing.prefixes and Routing.admin are used when a Router instance is created
|
||||
* or reset
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testRoutingPrefixesSetting() {
|
||||
$restore = Configure::read('Routing');
|
||||
|
||||
Configure::write('Routing.admin', 'admin');
|
||||
Configure::write('Routing.prefixes', array('member', 'super_user'));
|
||||
Router::reload();
|
||||
$result = Router::prefixes();
|
||||
$expected = array('admin', 'member', 'super_user');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
Configure::write('Routing.prefixes', 'member');
|
||||
Router::reload();
|
||||
$result = Router::prefixes();
|
||||
$expected = array('admin', 'member');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
Configure::write('Routing', $restore);
|
||||
}
|
||||
|
||||
/**
|
||||
* testAdminRouting method
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue