mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-29 13:36: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 ?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
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
self::ensureKernelShutdown();
|
self::ensureKernelShutdown();
|
||||||
@ -427,8 +417,9 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
|||||||
*/
|
*/
|
||||||
public function testAccompanyingCourseShow(int $personId, int $periodId)
|
public function testAccompanyingCourseShow(int $personId, int $periodId)
|
||||||
{
|
{
|
||||||
$c = $this->client->request(Request::METHOD_GET, sprintf('/api/1.0/person/accompanying-course/%d.json', $periodId));
|
$client = $this->getClientAuthenticated();
|
||||||
$response = $this->client->getResponse();
|
$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));
|
$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)
|
public function testReferralAvailable(int $personId, int $periodId)
|
||||||
{
|
{
|
||||||
$this->client->request(
|
$client = $this->getClientAuthenticated();
|
||||||
|
$client->request(
|
||||||
Request::METHOD_POST,
|
Request::METHOD_POST,
|
||||||
sprintf('/api/1.0/person/accompanying-course/%d/referrers-suggested.json', $periodId)
|
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()
|
public function testShow404()
|
||||||
{
|
{
|
||||||
$this->client->request(Request::METHOD_GET, sprintf('/api/1.0/person/accompanying-course/%d.json', 99999));
|
$client = $this->getClientAuthenticated();
|
||||||
$response = $this->client->getResponse();
|
$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)");
|
$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