Skip to content

Commit b9d6dc4

Browse files
committed
IHF: multiarray_sort_by tests added.
1 parent 0c93ecc commit b9d6dc4

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

tests/array/MultiarraySortByTest.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,25 @@ public function it_can_sort_by_one_field_without_specifying_sort_order_which_is_
2121
}
2222

2323
/** @test */
24-
public function it_can_sort_by_one_field_with_specifying_sort_order()
24+
public function it_can_sort_by_one_field_with_specifying_asc_sort_order()
25+
{
26+
$array = [
27+
['name' => 'Mercedes-Benz', 'model' => 'GLE Coupe', 'price' => 110000],
28+
['name' => 'BMW', 'model' => 'X6', 'price' => 77000],
29+
['name' => 'Porsche', 'model' => 'Cayenne', 'price' => 117000],
30+
];
31+
32+
$expected = [
33+
['name' => 'BMW', 'model' => 'X6', 'price' => 77000],
34+
['name' => 'Mercedes-Benz', 'model' => 'GLE Coupe', 'price' => 110000],
35+
['name' => 'Porsche', 'model' => 'Cayenne', 'price' => 117000],
36+
];
37+
38+
$this->assertEquals($expected, multiarray_sort_by($array, 'price', SORT_ASC));
39+
}
40+
41+
/** @test */
42+
public function it_can_sort_by_one_field_with_specifying_desc_sort_order()
2543
{
2644
$array = [
2745
['name' => 'Mercedes-Benz', 'model' => 'GLE Coupe', 'price' => 110000],

0 commit comments

Comments
 (0)