| @@ 32-45 (lines=14) @@ | ||
| 29 | $loader->getAddonNames(); |
|
| 30 | } |
|
| 31 | ||
| 32 | public function testNonJsonResponsesAreHandled() |
|
| 33 | { |
|
| 34 | $loader = $this->getSupportedAddonsLoader(); |
|
| 35 | $loader->setGuzzleClient($this->getMockClient(new Response( |
|
| 36 | 200, |
|
| 37 | ['Content-Type' => 'text/html; charset=utf-8'] |
|
| 38 | ))); |
|
| 39 | ||
| 40 | $this->setExpectedException( |
|
| 41 | RuntimeException::class, |
|
| 42 | 'Could not obtain information about supported addons. Response is not JSON' |
|
| 43 | ); |
|
| 44 | $loader->getAddonNames(); |
|
| 45 | } |
|
| 46 | ||
| 47 | public function testUnsuccessfulResponsesAreHandled() |
|
| 48 | { |
|
| @@ 47-61 (lines=15) @@ | ||
| 44 | $loader->getAddonNames(); |
|
| 45 | } |
|
| 46 | ||
| 47 | public function testUnsuccessfulResponsesAreHandled() |
|
| 48 | { |
|
| 49 | $loader = $this->getSupportedAddonsLoader(); |
|
| 50 | $loader->setGuzzleClient($this->getMockClient(new Response( |
|
| 51 | 200, |
|
| 52 | ['Content-Type' => 'application/json'], |
|
| 53 | json_encode(['success' => 'false']) |
|
| 54 | ))); |
|
| 55 | ||
| 56 | $this->setExpectedException( |
|
| 57 | RuntimeException::class, |
|
| 58 | 'Could not obtain information about supported addons. Response returned unsuccessfully' |
|
| 59 | ); |
|
| 60 | $loader->getAddonNames(); |
|
| 61 | } |
|
| 62 | ||
| 63 | ||
| 64 | public function testAddonsAreParsedAndReturnedCorrectly() |
|