From 628a79aba67375a7b47560ba6975c6a4fd3f226b Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 14 Jan 2009 04:06:01 +0000 Subject: [PATCH] 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 --- cake/libs/set.php | 3 ++- cake/tests/cases/libs/set.test.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cake/libs/set.php b/cake/libs/set.php index 21ce80de9..f7782a41a 100644 --- a/cake/libs/set.php +++ b/cake/libs/set.php @@ -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') { diff --git a/cake/tests/cases/libs/set.test.php b/cake/tests/cases/libs/set.test.php index 041bcf883..126bd9a52 100644 --- a/cake/tests/cases/libs/set.test.php +++ b/cake/tests/cases/libs/set.test.php @@ -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); } /**