@@ 15-22 (lines=8) @@ | ||
12 | */ |
|
13 | class SerializerTest extends PHPUnit_Framework_TestCase |
|
14 | { |
|
15 | public function testCollectionWithDefaultResourceKey() |
|
16 | { |
|
17 | $data = ['foo']; |
|
18 | $serializer = new Serializer(); |
|
19 | $result = $serializer->collection(null, $data); |
|
20 | ||
21 | $this->assertSame(['data' => $data], $result); |
|
22 | } |
|
23 | ||
24 | public function testCollectionWithCustomResourceKey() |
|
25 | { |
|
@@ 24-31 (lines=8) @@ | ||
21 | $this->assertSame(['data' => $data], $result); |
|
22 | } |
|
23 | ||
24 | public function testCollectionWithCustomResourceKey() |
|
25 | { |
|
26 | $data = ['foo']; |
|
27 | $serializer = new Serializer(); |
|
28 | $result = $serializer->collection('custom', $data); |
|
29 | ||
30 | $this->assertSame(['custom' => $data], $result); |
|
31 | } |
|
32 | ||
33 | public function testCollectionWithOptionalResourceKey() |
|
34 | { |
|
@@ 46-53 (lines=8) @@ | ||
43 | $this->assertSame(['optional' => $data], $result); |
|
44 | } |
|
45 | ||
46 | public function testItemWithDefaultResourceKey() |
|
47 | { |
|
48 | $data = ['foo']; |
|
49 | $serializer = new Serializer(); |
|
50 | $result = $serializer->item(null, $data); |
|
51 | ||
52 | $this->assertSame(['data' => $data], $result); |
|
53 | } |
|
54 | ||
55 | public function testItemWithCustomResourceKey() |
|
56 | { |
|
@@ 55-62 (lines=8) @@ | ||
52 | $this->assertSame(['data' => $data], $result); |
|
53 | } |
|
54 | ||
55 | public function testItemWithCustomResourceKey() |
|
56 | { |
|
57 | $data = ['foo']; |
|
58 | $serializer = new Serializer(); |
|
59 | $result = $serializer->collection('custom', $data); |
|
60 | ||
61 | $this->assertSame(['custom' => $data], $result); |
|
62 | } |
|
63 | ||
64 | public function testItemWithOptionalResourceKey() |
|
65 | { |