Skip to content

Commit

Permalink
add test for array key map method
Browse files Browse the repository at this point in the history
  • Loading branch information
Muetze42 committed Dec 18, 2023
1 parent 764b712 commit a675342
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/Support/SupportArrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,16 @@ public function testMap()
$this->assertEquals(['first' => 'taylor', 'last' => 'otwell'], $data);
}

public function testKeyMap()
{
$data = ['First' => 'taylor', 'Last' => 'otwell'];
$mapped = Arr::keyMap(function ($key) {
return strtolower($key);
}, $data);
$this->assertEquals(['first' => 'taylor', 'last' => 'otwell'], $mapped);
$this->assertEquals(['First' => 'taylor', 'Last' => 'otwell'], $data);
}

public function testMapWithKeys()
{
$data = [
Expand Down

0 comments on commit a675342

Please sign in to comment.