From a6753428280d24eee2e90a3cbe3c6d1cf89c8f14 Mon Sep 17 00:00:00 2001 From: Norman Huth Date: Mon, 18 Dec 2023 19:19:55 +0100 Subject: [PATCH] add test for array key map method --- tests/Support/SupportArrTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/Support/SupportArrTest.php b/tests/Support/SupportArrTest.php index a539eb4b2b02..6065d7fde70b 100644 --- a/tests/Support/SupportArrTest.php +++ b/tests/Support/SupportArrTest.php @@ -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 = [