|
@@ 49-59 (lines=11) @@
|
| 46 |
|
* @param string $route |
| 47 |
|
* @param int $expectedItems |
| 48 |
|
*/ |
| 49 |
|
protected function checkGetAll(string $route, int $expectedItems) |
| 50 |
|
{ |
| 51 |
|
$client = $this->getClient('GET', $route); |
| 52 |
|
$this->checkStatusCodeAndContentType($client, 200); |
| 53 |
|
|
| 54 |
|
$items = json_decode($client->getResponse()->getContent()); |
| 55 |
|
|
| 56 |
|
$this->checkIfListHaveRightStructure($items); |
| 57 |
|
|
| 58 |
|
$this->checkItemList($items, $expectedItems); |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
/** |
| 62 |
|
* @param string $route |
|
@@ 78-86 (lines=9) @@
|
| 75 |
|
/** |
| 76 |
|
* @param string $route |
| 77 |
|
*/ |
| 78 |
|
protected function checkGetAUnexistingElement(string $route) |
| 79 |
|
{ |
| 80 |
|
$client = $this->getClient('GET', $route); |
| 81 |
|
$this->checkStatusCodeAndContentType($client, '404'); |
| 82 |
|
$adresse = json_decode($client->getResponse()->getContent()); |
| 83 |
|
|
| 84 |
|
$this->assertArrayHasKey('message', (array) $adresse); |
| 85 |
|
$this->assertEquals('Element not found', $adresse->message); |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
/** |
| 89 |
|
* @param string $route |