Conditions | 1 |
Paths | 1 |
Total Lines | 28 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public function testSerializingNullResource() |
||
16 | { |
||
17 | $manager = new Manager(); |
||
18 | $manager->parseIncludes('author'); |
||
19 | $manager->setSerializer(new ExplicitNullArraySerializer()); |
||
20 | |||
21 | $resource = new NullResource(null, new GenericBookTransformer(), 'books'); |
||
22 | |||
23 | // Try without metadata |
||
24 | $scope = new Scope($manager, $resource); |
||
25 | |||
26 | $expected = null; |
||
27 | $this->assertSame($expected, $scope->toArray()); |
||
28 | |||
29 | // JSON array of JSON objects |
||
30 | $expectedJson = 'null'; |
||
31 | $this->assertSame($expectedJson, $scope->toJson()); |
||
32 | |||
33 | // Same again with metadata |
||
34 | $resource->setMetaValue('foo', 'bar'); |
||
35 | $scope = new Scope($manager, $resource); |
||
36 | |||
37 | $expected = null; |
||
38 | $this->assertSame($expected, $scope->toArray()); |
||
39 | |||
40 | $expectedJson = 'null'; |
||
41 | $this->assertSame($expectedJson, $scope->toJson()); |
||
42 | } |
||
43 | } |
||
44 |