Skip to content

Commit

Permalink
Fixing isset() checks in Router to test for empty values instead.
Browse files Browse the repository at this point in the history
Updating prefix use in paginator helper test.
  • Loading branch information
markstory committed Sep 30, 2009
1 parent 17782f7 commit 893e177
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cake/libs/router.php
Expand Up @@ -177,10 +177,10 @@ function Router() {
**/
function __setPrefixes() {
$routing = Configure::read('Routing');
if (isset($routing['admin'])) {
if (!empty($routing['admin'])) {
$this->__prefixes[] = $routing['admin'];
}
if (isset($routing['prefixes'])) {
if (!empty($routing['prefixes'])) {
$this->__prefixes = array_merge($this->__prefixes, (array)$routing['prefixes']);
}
}
Expand Down
9 changes: 7 additions & 2 deletions cake/tests/cases/libs/view/helpers/paginator.test.php
Expand Up @@ -449,8 +449,11 @@ function testUrlGeneration() {
* @return void
*/
function testUrlGenerationWithPrefixes() {
$memberPrefixes = array('prefix' => 'members', 'members' => true);
Router::connect('/members/:controller/:action/*', $memberPrefixes);
$_back = Configure::read('Routing');

Configure::write('Routing.prefixes', array('members'));
Router::reload();

Router::parse('/');

Router::setRequestInfo( array(
Expand Down Expand Up @@ -500,6 +503,8 @@ function testUrlGenerationWithPrefixes() {
$result = $this->Paginator->url($options);
$expected = '/posts/index/page:2/sort:Article.name/direction:desc';
$this->assertEqual($result, $expected);

Configure::write('Routing', $_back);
}

/**
Expand Down

0 comments on commit 893e177

Please sign in to comment.