Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
namespace App\tests\Api;
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
use App\Factory\RegionFactory;
class RegionTest extends ApiTestCase
{
public function testGetRegionCollection(): void
{
// Remplace '/api/taxes' par l'URL réelle de ta ressource API
$response = static::createClient()->request('GET', '/regions');
$this->assertResponseIsSuccessful();
// Vérifie que c'est du JSON-LD (standard API Platform)
$this->assertJsonContains([
'@type' => 'Collection',
]);
}
public function testGetRegion(): void
{
$region = RegionFactory::createOne();
$response = static::createClient()->request('GET', '/regions/' . $region->getId());
$this->assertResponseIsSuccessful();
$this->assertJsonContains([
'id' => $region->getId(),
]);
}
}
{
}