mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-29 05:26:13 +00:00
Fix direct kernel deprecation in AccompanyingCourseApiControllerTest
This commit is contained in:
parent
b65f76262a
commit
efcb903d10
@ -52,16 +52,6 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
|
||||
private ?int $personId = null;
|
||||
|
||||
private KernelBrowser $client;
|
||||
|
||||
/**
|
||||
* Setup before each test method (see phpunit doc).
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->client = $this->getClientAuthenticated();
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
self::ensureKernelShutdown();
|
||||
@ -427,8 +417,9 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
*/
|
||||
public function testAccompanyingCourseShow(int $personId, int $periodId)
|
||||
{
|
||||
$c = $this->client->request(Request::METHOD_GET, sprintf('/api/1.0/person/accompanying-course/%d.json', $periodId));
|
||||
$response = $this->client->getResponse();
|
||||
$client = $this->getClientAuthenticated();
|
||||
$client->request(Request::METHOD_GET, sprintf('/api/1.0/person/accompanying-course/%d.json', $periodId));
|
||||
$response = $client->getResponse();
|
||||
|
||||
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
|
||||
|
||||
@ -548,12 +539,13 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
*/
|
||||
public function testReferralAvailable(int $personId, int $periodId)
|
||||
{
|
||||
$this->client->request(
|
||||
$client = $this->getClientAuthenticated();
|
||||
$client->request(
|
||||
Request::METHOD_POST,
|
||||
sprintf('/api/1.0/person/accompanying-course/%d/referrers-suggested.json', $periodId)
|
||||
);
|
||||
|
||||
$this->assertTrue(in_array($this->client->getResponse()->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(in_array($client->getResponse()->getStatusCode(), [200, 422], true));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -732,8 +724,9 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
|
||||
public function testShow404()
|
||||
{
|
||||
$this->client->request(Request::METHOD_GET, sprintf('/api/1.0/person/accompanying-course/%d.json', 99999));
|
||||
$response = $this->client->getResponse();
|
||||
$client = $this->getClientAuthenticated();
|
||||
$client->request(Request::METHOD_GET, sprintf('/api/1.0/person/accompanying-course/%d.json', 99999));
|
||||
$response = $client->getResponse();
|
||||
|
||||
$this->assertEquals(404, $response->getStatusCode(), "Test that the response of rest api has a status code 'not found' (404)");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user