Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | public function testParse() |
||
22 | { |
||
23 | $context = new Array2ObjectContext(); |
||
24 | $context->setWriter(new AccessorWriter()); |
||
25 | $context->setMatcher(new CamelizeMatcher()); |
||
26 | $context->setParsers([new StringParser()]); |
||
27 | $parser = new ObjectParser($context); |
||
28 | |||
29 | $object = new Team(); |
||
30 | $property = new \ReflectionProperty(get_class($object), 'name'); |
||
31 | |||
32 | /** @var Team $team */ |
||
33 | $team = $parser->parseValue(['name' => 'New Name'], 'Team', $property, $object); |
||
34 | static::assertInstanceOf(Team::class, $team); |
||
35 | static::assertEquals('New Name', $team->getName()); |
||
36 | } |
||
37 | } |
||
38 |