@@ 33-44 (lines=12) @@ | ||
30 | $this->assertSame(['custom' => $data], $result); |
|
31 | } |
|
32 | ||
33 | public function testCollectionWithOptionalResourceKey() |
|
34 | { |
|
35 | $data = ['foo']; |
|
36 | $serializer = new OptionalKeySerializer(); |
|
37 | $result = $serializer->collection(null, $data); |
|
38 | ||
39 | $this->assertSame($data, $result); |
|
40 | ||
41 | $result = $serializer->collection('optional', $data); |
|
42 | ||
43 | $this->assertSame(['optional' => $data], $result); |
|
44 | } |
|
45 | ||
46 | public function testItemWithDefaultResourceKey() |
|
47 | { |
|
@@ 64-75 (lines=12) @@ | ||
61 | $this->assertSame(['custom' => $data], $result); |
|
62 | } |
|
63 | ||
64 | public function testItemWithOptionalResourceKey() |
|
65 | { |
|
66 | $data = ['foo']; |
|
67 | $serializer = new OptionalKeySerializer(); |
|
68 | $result = $serializer->item(null, $data); |
|
69 | ||
70 | $this->assertSame($data, $result); |
|
71 | ||
72 | $result = $serializer->item('optional', $data); |
|
73 | ||
74 | $this->assertSame(['optional' => $data], $result); |
|
75 | } |
|
76 | } |
|
77 |