Skip to content

Commit

Permalink
Make sure direction values are lowercased to be consistent.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Scherer committed Oct 27, 2015
1 parent 9d7d63c commit 928c7ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/View/Helper/PaginatorHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ public function sort($key, $title = null, array $options = [])

$title = __(Inflector::humanize(preg_replace('/_id$/', '', $title)));
}
$defaultDir = isset($options['direction']) ? $options['direction'] : 'asc';
$defaultDir = isset($options['direction']) ? strtolower($options['direction']) : 'asc';
unset($options['direction']);

$locked = isset($options['lock']) ? $options['lock'] : false;
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/View/Helper/PaginatorHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public function testSortLinks()

$this->Paginator->request->params['paging']['Article']['sort'] = 'Article.title';
$this->Paginator->request->params['paging']['Article']['direction'] = 'desc';
$result = $this->Paginator->sort('title', 'Title', ['direction' => 'asc']);
$result = $this->Paginator->sort('title', 'Title', ['direction' => 'ASC']);
$expected = [
'a' => ['href' => '/accounts/index/param?sort=title&direction=asc', 'class' => 'desc'],
'Title',
Expand Down

0 comments on commit 928c7ca

Please sign in to comment.