Adding test cases for Routing.prefixes.

This commit is contained in:
mark_story 2009-09-26 22:48:57 -04:00
parent 3904c6f7b5
commit 3e394f1fa8
2 changed files with 26 additions and 1 deletions

View file

@ -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']);
}
}
/**

View file

@ -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
*