Skip to content
This repository was archived by the owner on Mar 12, 2024. It is now read-only.

Commit b3d9193

Browse files
committed
add tests
1 parent 41c0389 commit b3d9193

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

tests/ArrayMappingTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,19 @@ public function testCanMapAnArrayRecursively()
4848
$this->assertNull($this->password);
4949
$this->assertStringContainsString('test', $this->next);
5050
}
51+
52+
/** @test */
53+
public function testAlreadyInitializedPropertiesArentOverridesByNestedArrays()
54+
{
55+
$array = [
56+
'name' => 'Michael Rubel',
57+
'additional_data' => [
58+
'name' => 'test',
59+
],
60+
];
61+
62+
$this->arrayToProperties($array);
63+
64+
$this->assertStringContainsString('Michael', $this->name);
65+
}
5166
}

tests/AttributeMappingTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public function testMappingIgnoresDifferentTypes()
5151

5252
$this->attributesToProperties($model);
5353

54-
$this->assertFalse((new \ReflectionProperty($this, 'name'))->isInitialized($this));
55-
$this->assertFalse((new \ReflectionProperty($this, 'files'))->isInitialized($this));
54+
$this->assertFalse(isset($this->name));
55+
$this->assertFalse(isset($this->files));
5656

5757
$this->assertInstanceOf(\Closure::class, $this->default);
5858
$this->assertTrue(($this->default)());

0 commit comments

Comments
 (0)