From cc7c1a28ee7a8db8ffd4b580ca66c426d1b83483 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 27 Feb 2023 13:42:08 +0100 Subject: [PATCH] Add test for https://github.com/CuyZ/Valinor/issues/337 --- .../Mapping/Object/ArrayValuesMappingTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/Integration/Mapping/Object/ArrayValuesMappingTest.php b/tests/Integration/Mapping/Object/ArrayValuesMappingTest.php index cbd1cf94..d80e9b09 100644 --- a/tests/Integration/Mapping/Object/ArrayValuesMappingTest.php +++ b/tests/Integration/Mapping/Object/ArrayValuesMappingTest.php @@ -67,6 +67,17 @@ public function test_values_are_mapped_properly(): void } } + public function test_key_is_class_name(): void + { + try { + $result = (new MapperBuilder())->mapper()->map('array{ArrayObject: "ArrayObject"}', ['ArrayObject' => 'test']); + } catch (MappingError $error) { + $this->mappingFail($error); + } + + self::assertSame(['ArrayObject' => 'ArrayObject'], $result); + } + public function test_empty_array_in_non_empty_array_throws_exception(): void { try {