Skip to content

Commit

Permalink
[11.x] Add test for Arr::sortRecursiveDesc() method. (#51716)
Browse files Browse the repository at this point in the history
* add-test: Arr::sortRecursiveDesc method

* make style-ci happy
  • Loading branch information
lmottasin authored Jun 5, 2024
1 parent e404bd9 commit 92d1efd
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions tests/Support/SupportArrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,61 @@ public function testSortRecursive()
$this->assertEquals($expect, Arr::sortRecursive($array));
}

public function testSortRecursiveDesc()
{
$array = [
'empty' => [],
'nested' => [
'level1' => [
'level2' => [
'level3' => [2, 3, 1],
],
'values' => [4, 5, 6],
],
],
'mixed' => [
'a' => 1,
2 => 'b',
'c' => 3,
1 => 'd',
],
'numbered_index' => [
1 => 'e',
3 => 'c',
4 => 'b',
5 => 'a',
2 => 'd',
],
];

$expect = [
'empty' => [],
'mixed' => [
'c' => 3,
'a' => 1,
2 => 'b',
1 => 'd',
],
'nested' => [
'level1' => [
'values' => [6, 5, 4],
'level2' => [
'level3' => [3, 2, 1],
],
],
],
'numbered_index' => [
5 => 'a',
4 => 'b',
3 => 'c',
2 => 'd',
1 => 'e',
],
];

$this->assertEquals($expect, Arr::sortRecursiveDesc($array));
}

public function testToCssClasses()
{
$classes = Arr::toCssClasses([
Expand Down

0 comments on commit 92d1efd

Please sign in to comment.