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 26, 2015
1 parent a99766c commit 8287981
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function testSortLinks() {

$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'asc'));
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'ASC'));
$this->assertRegExp('/\/accounts\/index\/param\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);

$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/View/Helper/PaginatorHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public function sort($key, $title = null, $options = array()) {

$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

0 comments on commit 8287981

Please sign in to comment.