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

@@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Tests\Controller;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Test\PrepareClientTrait;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\Resource;
use Chill\PersonBundle\Entity\Person;
@@ -22,6 +23,7 @@ use Chill\ThirdPartyBundle\Entity\ThirdParty;
use DateTime;
use Doctrine\ORM\EntityManagerInterface;
use Iterator;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Request;
use function array_map;
@@ -40,31 +42,29 @@ use function json_encode;
*/
final class AccompanyingCourseApiControllerTest extends WebTestCase
{
protected static EntityManagerInterface $em;
use PrepareClientTrait;
protected ?AccompanyingPeriod $period = null;
private static EntityManagerInterface $em;
protected ?int $periodId = null;
private ?AccompanyingPeriod $period = null;
protected ?int $personId = null;
private ?int $periodId = null;
/**
* Setup before the first test of this class (see phpunit doc).
*/
public static function setUpBeforeClass(): void
{
self::bootKernel();
}
private ?int $personId = null;
private KernelBrowser $client;
/**
* Setup before each test method (see phpunit doc).
*/
protected function setUp(): void
{
$this->client = self::createClient([], [
'PHP_AUTH_USER' => 'center a_social',
'PHP_AUTH_PW' => 'password',
]);
$this->client = $this->getClientAuthenticated();
}
protected function tearDown(): void
{
self::ensureKernelShutdown();
}
public function dataGenerateNewAccompanyingCourse()
@@ -100,6 +100,8 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
$em->flush();
yield [$period];
self::ensureKernelShutdown();
}
public function dataGenerateRandomAccompanyingCourse()
@@ -165,6 +167,8 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
++$nbGenerated;
}
self::ensureKernelShutdown();
}
public function dataGenerateRandomAccompanyingCourseWithSocialIssue()
@@ -235,6 +239,8 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
++$nbGenerated;
}
self::ensureKernelShutdown();
}
public function dataGenerateRandomRequestorValidData(): Iterator
@@ -302,6 +308,8 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
yield [$period, array_pop($personIds)['id'], array_pop($thirdPartyIds)['id']];
++$i;
}
self::ensureKernelShutdown();
}
/**