mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
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:
parent
a6250ad648
commit
628a79aba6
2 changed files with 3 additions and 2 deletions
|
@ -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') {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue