|
@@ 64-75 (lines=12) @@
|
| 61 |
|
* @param string $route |
| 62 |
|
* @param int $expectedItems |
| 63 |
|
*/ |
| 64 |
|
protected function checkGetAll(string $route, int $expectedItems) |
| 65 |
|
{ |
| 66 |
|
$client = $this->getClient(); |
| 67 |
|
$client->request('GET', $route); |
| 68 |
|
$this->checkStatusCodeAndContentType($client, 200); |
| 69 |
|
|
| 70 |
|
$items = json_decode($client->getResponse()->getContent()); |
| 71 |
|
|
| 72 |
|
$this->checkIfListHaveRightStructure($items); |
| 73 |
|
|
| 74 |
|
$this->checkItemList($items, $expectedItems); |
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
/** |
| 78 |
|
* @param string $route |
|
@@ 95-104 (lines=10) @@
|
| 92 |
|
/** |
| 93 |
|
* @param string $route |
| 94 |
|
*/ |
| 95 |
|
protected function checkGetAUnexistingElement(string $route) |
| 96 |
|
{ |
| 97 |
|
$client = $this->getClient(); |
| 98 |
|
$client->request('GET', $route); |
| 99 |
|
$this->checkStatusCodeAndContentType($client, '404'); |
| 100 |
|
$adresse = json_decode($client->getResponse()->getContent()); |
| 101 |
|
|
| 102 |
|
$this->assertArrayHasKey('message', (array) $adresse); |
| 103 |
|
$this->assertSame('Element not found', $adresse->message); |
| 104 |
|
} |
| 105 |
|
|
| 106 |
|
/** |
| 107 |
|
* @param string $route |