|
@@ 61-64 (lines=4) @@
|
| 58 |
|
verify($item)->hasKey('data'); |
| 59 |
|
}); |
| 60 |
|
|
| 61 |
|
$this->specify('The book title must equal "Test Book".', function () { |
| 62 |
|
$item = $this->service->item($this->book, $this->transformer)->toArray(); |
| 63 |
|
verify($item['data']['title'])->equals('Test Book'); |
| 64 |
|
}); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
/** |
|
@@ 128-131 (lines=4) @@
|
| 125 |
|
*/ |
| 126 |
|
public function testAssertJson() |
| 127 |
|
{ |
| 128 |
|
$this->specify('The item has to be in JSON format.', function () { |
| 129 |
|
$item = $this->service->item($this->book, $this->transformer)->toJson(); |
| 130 |
|
verify($item)->equals('{"data":{"title":"Test Book","publisher":"Test Publisher","author":{"data":{"firstName":"Test","lastName":"Author"}}}}'); |
| 131 |
|
}); |
| 132 |
|
|
| 133 |
|
$this->specify('The collection has to be in JSON format.', function () { |
| 134 |
|
$collection = $this->service->collection([$this->book], $this->transformer)->toJson(); |
|
@@ 133-136 (lines=4) @@
|
| 130 |
|
verify($item)->equals('{"data":{"title":"Test Book","publisher":"Test Publisher","author":{"data":{"firstName":"Test","lastName":"Author"}}}}'); |
| 131 |
|
}); |
| 132 |
|
|
| 133 |
|
$this->specify('The collection has to be in JSON format.', function () { |
| 134 |
|
$collection = $this->service->collection([$this->book], $this->transformer)->toJson(); |
| 135 |
|
verify($collection)->equals('{"data":[{"title":"Test Book","publisher":"Test Publisher","author":{"data":{"firstName":"Test","lastName":"Author"}}}]}'); |
| 136 |
|
}); |
| 137 |
|
} |
| 138 |
|
|
| 139 |
|
/** |