Conditions | 1 |
Total Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public function testModelToId(): void |
||
20 | { |
||
21 | $input = [ |
||
22 | 3 => new \stdClass(), |
||
23 | 4 => 1, |
||
24 | 'model' => new User(), |
||
25 | 'entity' => new class() extends EntityID { |
||
26 | public function __construct() |
||
27 | { |
||
28 | } |
||
29 | |||
30 | public function getEntity() |
||
31 | { |
||
32 | return 'real entity'; |
||
33 | } |
||
34 | }, |
||
35 | ]; |
||
36 | |||
37 | $actual = Utility::entityIdToModel($input); |
||
38 | |||
39 | $expected = $input; |
||
40 | $expected['entity'] = 'real entity'; |
||
41 | |||
42 | self::assertSame($expected, $actual, 'keys and non model values should be preserved'); |
||
43 | self::assertNull(Utility::entityIdToModel(null)); |
||
44 | self::assertSame([], Utility::entityIdToModel([])); |
||
45 | } |
||
47 |