Skip to content

Commit e434956

Browse files
authored
fix(array): add test for issue #259 (#263)
2 parents a7c1e64 + 767be97 commit e434956

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
AutoMapper\Tests\AutoMapperTest\ArrayNested\UserEntity {
2+
+"roles": [
3+
"ROLE_USER"
4+
]
5+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace AutoMapper\Tests\AutoMapperTest\ArrayNested;
6+
7+
use AutoMapper\Tests\AutoMapperBuilder;
8+
9+
class UserApiResource
10+
{
11+
public array $roles; // ["ROLE_USER"]
12+
}
13+
14+
class UserEntity
15+
{
16+
public function setRoles(array $roles)
17+
{
18+
$this->roles = $roles; // [["ROLE_USER"]];
19+
}
20+
}
21+
22+
return (function () {
23+
$autoMapper = AutoMapperBuilder::buildAutoMapper();
24+
25+
$userApiResource = new UserApiResource();
26+
$userApiResource->roles = ['ROLE_USER'];
27+
28+
yield 'array' => $autoMapper->map($userApiResource, UserEntity::class);
29+
})();

0 commit comments

Comments
 (0)