Skip to content
Permalink
Browse files

Adding test cases for Routing.prefixes.

  • Loading branch information...
markstory committed Sep 27, 2009
1 parent 3904c6f commit 3e394f1fa8f0caf528f0d37526fac0f8d27b42e7
Showing with 26 additions and 1 deletion.
  1. +1 −1 cake/libs/router.php
  2. +25 −0 cake/tests/cases/libs/router.test.php
@@ -186,7 +186,7 @@ function __setPrefixes() {
$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 @@ function testRouteSymmetry() {
$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
*

0 comments on commit 3e394f1

Please sign in to comment.
You can’t perform that action at this time.