Skip to content

Commit

Permalink
Making direction flag in Set::sort() case insensitive. Test updated. F…
Browse files Browse the repository at this point in the history
…ixes #5992

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7977 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
markstory committed Jan 14, 2009
1 parent a6250ad commit 628a79a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cake/libs/set.php
Expand Up @@ -1086,7 +1086,8 @@ function __flatten($results, $key = null) {
function sort($data, $path, $dir) {
$result = Set::__flatten(Set::extract($data, $path));
list($keys, $values) = array(Set::extract($result, '{n}.id'), Set::extract($result, '{n}.value'));


$dir = strtolower($dir);
if ($dir === 'asc') {
$dir = SORT_ASC;
} elseif ($dir === 'desc') {
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/libs/set.test.php
Expand Up @@ -335,7 +335,7 @@ function testSort() {
0 => array('Shirt' => array('color' => 'black')),
1 => array('Person' => array('name' => 'Jeff')),
);
$a = Set::sort($a, '{n}.Person.name', 'asc');
$a = Set::sort($a, '{n}.Person.name', 'ASC');
$this->assertIdentical($a, $b);
}
/**
Expand Down

0 comments on commit 628a79a

Please sign in to comment.