Skip to content

Commit

Permalink
Adding test cases for Routing.prefixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Sep 27, 2009
1 parent 3904c6f commit 3e394f1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cake/libs/router.php
Expand Up @@ -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']);
}
}
/**
Expand Down
25 changes: 25 additions & 0 deletions cake/tests/cases/libs/router.test.php
Expand Up @@ -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
*
Expand Down

0 comments on commit 3e394f1

Please sign in to comment.