Making direction flag in Set::sort() case insensitive. Test updated. Fixes #5992

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7977 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mark_story 2009-01-14 04:06:01 +00:00
parent a6250ad648
commit 628a79aba6
2 changed files with 3 additions and 2 deletions

View file

@ -1086,7 +1086,8 @@ class Set extends Object {
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') {

View file

@ -335,7 +335,7 @@ class SetTest extends CakeTestCase {
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);
}
/**