Replaced the deprecated 'self::$container->get' with 'self::getContainer()->get' using rector

This change is made to comply with the new Symfony standards and to avoid deprecation warnings for future versions. The update touches various functionalities, including retrieving EntityManagerInterface instance and various service classes within the test files.
This commit is contained in:
2023-12-14 23:36:56 +01:00
parent 4a99480f50
commit 1098bafd3d
248 changed files with 631 additions and 628 deletions

View File

@@ -51,7 +51,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
public function dataGenerateNewAccompanyingCourse()
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$period = new AccompanyingPeriod(new \DateTime('1 week ago'));
$user = $em->getRepository(User::class)
@@ -99,7 +99,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
$maxResults = $maxGenerated * 8;
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$center = $em->getRepository(Center::class)
->findOneBy(['name' => 'Center A']);
@@ -166,7 +166,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
$maxResults = $maxGenerated * 8;
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$center = $em->getRepository(Center::class)
->findOneBy(['name' => 'Center A']);
$qb = $em->createQueryBuilder();
@@ -230,7 +230,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
$maxResults = 100;
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$center = $em->getRepository(Center::class)
->findOneBy(['name' => 'Center A']);
$qb = $em->createQueryBuilder();
@@ -433,10 +433,10 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
public function testAccompanyingPeriodPatch(int $personId, int $periodId)
{
$this->markTestIncomplete('fix test with validation');
$period = self::$container->get(AccompanyingPeriodRepository::class)
$period = self::getContainer()->get(AccompanyingPeriodRepository::class)
->find($periodId);
$initialValueEmergency = $period->isEmergency();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$this->client->request(
Request::METHOD_PATCH,
@@ -469,7 +469,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
public function testCommentWithValidData(AccompanyingPeriod $period, mixed $personId, mixed $thirdPartyId)
{
$this->markTestIncomplete('fix test with validation');
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$this->client->request(
Request::METHOD_POST,
@@ -545,7 +545,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
public function testRequestorWithValidData(AccompanyingPeriod $period, mixed $personId, mixed $thirdPartyId)
{
$this->markTestIncomplete('fix test with validation');
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
// post a person
$this->client->request(
@@ -626,7 +626,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
public function testResourceWithValidData(AccompanyingPeriod $period, mixed $personId, mixed $thirdPartyId)
{
$this->markTestIncomplete('fix test with validation');
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
// post a person
$this->client->request(