Skip to content

Commit

Permalink
Adding tests to PaginatorHelper::sort() for creating sort links that …
Browse files Browse the repository at this point in the history
…point at plugin shortcuts. Refs #535.
  • Loading branch information
markstory committed Apr 2, 2010
1 parent ffb5c36 commit d058234
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions cake/tests/cases/libs/view/helpers/paginator.test.php
Expand Up @@ -218,6 +218,28 @@ function testSortLinks() {
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
}

/**
* test sort() works with plugin shortcut routes.
*
* @return void
*/
function testSortWithPluginShortcuts() {
Router::reload();
Router::parse('/');
Router::setRequestInfo(array(
array('plugin' => 'test_plugin', 'controller' => 'test_plugin', 'action' => 'something', 'pass' => array(), 'form' => array(), 'url' => array('url' => 'test_plugin/something')),
array('base' => '/', 'here' => '/test_plugin/', 'webroot' => '/')
));

$result = $this->Paginator->sort('title');
$expected = array(
'a' => array('href' => '/test_plugin/something/page:1/sort:title/direction:asc'),
'Title',
'/a'
);
$this->assertTags($result, $expected);
}


/**
* testSortLinksUsingDirectionOption method
Expand Down

0 comments on commit d058234

Please sign in to comment.