| @@ 10-19 (lines=10) @@ | ||
| 7 | { |
|
| 8 | protected static $fixture_file = 'RatingApiControllerTest.yml'; |
|
| 9 | ||
| 10 | public function testErrorWhenMissingParams() |
|
| 11 | { |
|
| 12 | $response = $this->get('api/rating'); |
|
| 13 | ||
| 14 | $this->assertJson($response->getBody()); |
|
| 15 | ||
| 16 | $result = json_decode($response->getBody()); |
|
| 17 | $this->assertFalse($result->success); |
|
| 18 | $this->assertContains('Missing', $result->message); |
|
| 19 | } |
|
| 20 | ||
| 21 | public function testErrorWhenModuleNotFound() |
|
| 22 | { |
|
| @@ 21-30 (lines=10) @@ | ||
| 18 | $this->assertContains('Missing', $result->message); |
|
| 19 | } |
|
| 20 | ||
| 21 | public function testErrorWhenModuleNotFound() |
|
| 22 | { |
|
| 23 | $response = $this->get('api/rating/bar/baz'); |
|
| 24 | ||
| 25 | $this->assertJson($response->getBody()); |
|
| 26 | ||
| 27 | $result = json_decode($response->getBody()); |
|
| 28 | $this->assertFalse($result->success); |
|
| 29 | $this->assertContains('not be found', $result->message); |
|
| 30 | } |
|
| 31 | ||
| 32 | public function testResponseIncludesRating() |
|
| 33 | { |
|
| @@ 10-20 (lines=11) @@ | ||
| 7 | { |
|
| 8 | protected static $fixture_file = 'SupportedAddonsApiControllerTest.yml'; |
|
| 9 | ||
| 10 | public function testOnlySupportedAddonsAreReturned() |
|
| 11 | { |
|
| 12 | $response = $this->get('api/supported-addons'); |
|
| 13 | ||
| 14 | $this->assertJson($response->getBody()); |
|
| 15 | ||
| 16 | $result = json_decode($response->getBody()); |
|
| 17 | $this->assertTrue($result->success); |
|
| 18 | $this->assertContains('foo/supported-bar', $result->addons); |
|
| 19 | $this->assertNotContains('foo/unsupported-bar', $result->addons); |
|
| 20 | } |
|
| 21 | } |
|
| 22 | ||