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

Commit d99f4f5

Browse files
committed
additional test
1 parent da513e7 commit d99f4f5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/ArrayMappingTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class ArrayMappingTest extends TestCase
1111
public bool $test;
1212
public string $name;
1313
public ?string $password = null;
14+
public string $next;
1415

1516
/** @test */
1617
public function testCanMapAnArrayToProperties()
@@ -27,4 +28,24 @@ public function testCanMapAnArrayToProperties()
2728
$this->assertStringContainsString('Michael', $this->name);
2829
$this->assertNull($this->password);
2930
}
31+
32+
/** @test */
33+
public function testCanMapAnArrayRecursively()
34+
{
35+
$array = [
36+
'test' => true,
37+
'name' => 'Michael Rubel',
38+
'password' => 'p@$$w0rd',
39+
'additional_data' => [
40+
'next' => 'test',
41+
],
42+
];
43+
44+
$this->arrayToProperties($array);
45+
46+
$this->assertTrue($this->test);
47+
$this->assertStringContainsString('Michael', $this->name);
48+
$this->assertNull($this->password);
49+
$this->assertStringContainsString('test', $this->next);
50+
}
3051
}

0 commit comments

Comments
 (0)