| @@ 92-111 (lines=20) @@ | ||
| 89 | $this->assertEquals($scope->jsonSerialize(), $scope->toArray()); |
|
| 90 | } |
|
| 91 | ||
| 92 | public function testToJson() |
|
| 93 | { |
|
| 94 | $data = [ |
|
| 95 | 'foo' => 'bar', |
|
| 96 | ]; |
|
| 97 | ||
| 98 | $manager = new Manager(); |
|
| 99 | ||
| 100 | $resource = new Item($data, function ($data) { |
|
| 101 | return $data; |
|
| 102 | }); |
|
| 103 | ||
| 104 | $scope = new Scope($manager, $resource); |
|
| 105 | ||
| 106 | $expected = json_encode([ |
|
| 107 | 'data' => $data, |
|
| 108 | ]); |
|
| 109 | ||
| 110 | $this->assertSame($expected, $scope->toJson()); |
|
| 111 | } |
|
| 112 | ||
| 113 | public function testToJsonWithOption() |
|
| 114 | { |
|
| @@ 113-132 (lines=20) @@ | ||
| 110 | $this->assertSame($expected, $scope->toJson()); |
|
| 111 | } |
|
| 112 | ||
| 113 | public function testToJsonWithOption() |
|
| 114 | { |
|
| 115 | $data = [ |
|
| 116 | 'foo' => 'bar', |
|
| 117 | ]; |
|
| 118 | ||
| 119 | $manager = new Manager(); |
|
| 120 | ||
| 121 | $resource = new Item($data, function ($data) { |
|
| 122 | return $data; |
|
| 123 | }); |
|
| 124 | ||
| 125 | $scope = new Scope($manager, $resource); |
|
| 126 | ||
| 127 | $expected = json_encode([ |
|
| 128 | 'data' => $data, |
|
| 129 | ], JSON_PRETTY_PRINT); |
|
| 130 | ||
| 131 | $this->assertSame($expected, $scope->toJson(JSON_PRETTY_PRINT)); |
|
| 132 | } |
|
| 133 | ||
| 134 | public function testGetCurrentScope() |
|
| 135 | { |
|