Remove deprecation linked to kernel shutdown

This commit is contained in:
2023-08-31 18:36:37 +02:00
parent 7c58880139
commit 6f11dffcbd
23 changed files with 166 additions and 85 deletions

View File

@@ -30,8 +30,6 @@ final class RelationshipApiControllerTest extends WebTestCase
{
use PrepareClientTrait;
private KernelBrowser $client;
/**
* A cache for all relations.
*
@@ -39,10 +37,9 @@ final class RelationshipApiControllerTest extends WebTestCase
*/
private ?array $relations = null;
protected function setUp(): void
protected function tearDown(): void
{
self::bootKernel();
$this->client = $this->getClientAuthenticated();
self::ensureKernelShutdown();
}
public function personProvider(): array
@@ -70,6 +67,8 @@ final class RelationshipApiControllerTest extends WebTestCase
->setFirstResult(random_int(0, $countPersons - 1))
->getSingleResult();
self::ensureKernelShutdown();
return [
[$person->getId()],
];
@@ -101,6 +100,8 @@ final class RelationshipApiControllerTest extends WebTestCase
->setFirstResult(random_int(0, $countPersons - 1))
->getResult();
self::ensureKernelShutdown();
return [
[$persons[0]->getId(), $persons[1]->getId(), $this->getRandomRelation($em)->getId(), true],
];
@@ -111,7 +112,8 @@ final class RelationshipApiControllerTest extends WebTestCase
*/
public function testGetRelationshipByPerson(mixed $personId)
{
$this->client->request(Request::METHOD_GET, sprintf('/api/1.0/relations/relationship/by-person/%d.json', $personId));
$client = $this->getClientAuthenticated();
$client->request(Request::METHOD_GET, sprintf('/api/1.0/relations/relationship/by-person/%d.json', $personId));
$response = $this->client->getResponse();
$this->assertEquals(200, $response->getStatusCode(), 'Test to see that API response returns a status code 200');
@@ -122,7 +124,9 @@ final class RelationshipApiControllerTest extends WebTestCase
*/
public function testPostRelationship(mixed $fromPersonId, mixed $toPersonId, mixed $relationId, mixed $isReverse): void
{
$this->client->request(
$client = $this->getClientAuthenticated();
$client->request(
Request::METHOD_POST,
'/api/1.0/relations/relationship.json',
[],
@@ -137,7 +141,7 @@ final class RelationshipApiControllerTest extends WebTestCase
], JSON_THROW_ON_ERROR)
);
$response = $this->client->getResponse();
$response = $client->getResponse();
$this->assertEquals(200, $response->getStatusCode());
}