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

@@ -45,7 +45,7 @@ final class CalendarControllerTest extends WebTestCase
public function provideAccompanyingPeriod(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$nb = $em->createQueryBuilder()
->from(AccompanyingPeriod::class, 'ac')

View File

@@ -70,7 +70,7 @@ final class RemoteCalendarMSGraphSyncControllerTest extends WebTestCase
$this->assertResponseStatusCodeSame(202);
/** @var InMemoryTransport $transport */
$transport = self::$container->get('messenger.transport.async');
$transport = self::getContainer()->get('messenger.transport.async');
$this->assertCount(1, $transport->getSent());
}

View File

@@ -36,7 +36,7 @@ final class AgentAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.calendar.export.agent_aggregator');
$this->aggregator = self::getContainer()->get('chill.calendar.export.agent_aggregator');
}
public function getAggregator()
@@ -55,7 +55,7 @@ final class AgentAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -36,7 +36,7 @@ final class CancelReasonAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.calendar.export.cancel_reason_aggregator');
$this->aggregator = self::getContainer()->get('chill.calendar.export.cancel_reason_aggregator');
}
public function getAggregator()
@@ -55,7 +55,7 @@ final class CancelReasonAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -36,7 +36,7 @@ final class JobAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.calendar.export.job_aggregator');
$this->aggregator = self::getContainer()->get('chill.calendar.export.job_aggregator');
}
public function getAggregator()
@@ -55,7 +55,7 @@ final class JobAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -36,7 +36,7 @@ final class LocationAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.calendar.export.location_aggregator');
$this->aggregator = self::getContainer()->get('chill.calendar.export.location_aggregator');
}
public function getAggregator()
@@ -55,7 +55,7 @@ final class LocationAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -36,7 +36,7 @@ final class LocationTypeAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.calendar.export.location_type_aggregator');
$this->aggregator = self::getContainer()->get('chill.calendar.export.location_type_aggregator');
}
public function getAggregator()
@@ -55,7 +55,7 @@ final class LocationTypeAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -36,7 +36,7 @@ final class MonthYearAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.calendar.export.month_aggregator');
$this->aggregator = self::getContainer()->get('chill.calendar.export.month_aggregator');
}
public function getAggregator()
@@ -55,7 +55,7 @@ final class MonthYearAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -36,7 +36,7 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.calendar.export.scope_aggregator');
$this->aggregator = self::getContainer()->get('chill.calendar.export.scope_aggregator');
}
public function getAggregator()
@@ -55,7 +55,7 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -43,7 +43,7 @@ final class AgentFilterTest extends AbstractFilterTest
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
$request->getLocale()->willReturn('fr');
$this->filter = self::$container->get('chill.calendar.export.agent_filter');
$this->filter = self::getContainer()->get('chill.calendar.export.agent_filter');
}
public function getFilter()
@@ -54,7 +54,7 @@ final class AgentFilterTest extends AbstractFilterTest
public function getFormData(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$array = $em->createQueryBuilder()
->from(User::class, 'u')
@@ -77,7 +77,7 @@ final class AgentFilterTest extends AbstractFilterTest
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
yield $em->createQueryBuilder()
->select('cal.id')

View File

@@ -43,7 +43,7 @@ final class BetweenDatesFilterTest extends AbstractFilterTest
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
$request->getLocale()->willReturn('fr');
$this->filter = self::$container->get('chill.calendar.export.between_dates_filter');
$this->filter = self::getContainer()->get('chill.calendar.export.between_dates_filter');
}
public function getFilter()
@@ -65,7 +65,7 @@ final class BetweenDatesFilterTest extends AbstractFilterTest
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -44,7 +44,7 @@ final class JobFilterTest extends AbstractFilterTest
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
$request->getLocale()->willReturn('fr');
$this->filter = self::$container->get('chill.calendar.export.job_filter');
$this->filter = self::getContainer()->get('chill.calendar.export.job_filter');
}
public function getFilter()
@@ -55,7 +55,7 @@ final class JobFilterTest extends AbstractFilterTest
public function getFormData(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$array = $em->createQueryBuilder()
->from(UserJob::class, 'uj')
@@ -75,7 +75,7 @@ final class JobFilterTest extends AbstractFilterTest
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -44,7 +44,7 @@ final class ScopeFilterTest extends AbstractFilterTest
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
$request->getLocale()->willReturn('fr');
$this->filter = self::$container->get('chill.calendar.export.scope_filter');
$this->filter = self::getContainer()->get('chill.calendar.export.scope_filter');
}
public function getFilter()
@@ -55,7 +55,7 @@ final class ScopeFilterTest extends AbstractFilterTest
public function getFormData(): array
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$array = $em->createQueryBuilder()
->from(Scope::class, 's')
@@ -75,7 +75,7 @@ final class ScopeFilterTest extends AbstractFilterTest
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -36,7 +36,7 @@ final class CalendarACLAwareRepositoryTest extends KernelTestCase
{
self::bootKernel();
$this->entityManager = self::$container->get(EntityManagerInterface::class);
$this->entityManager = self::getContainer()->get(EntityManagerInterface::class);
}
public function testCountByPerosn()

View File

@@ -32,7 +32,7 @@ final class CalendarNormalizerTest extends KernelTestCase
{
self::bootKernel();
$this->normalizer = self::$container->get(NormalizerInterface::class);
$this->normalizer = self::getContainer()->get(NormalizerInterface::class);
}
public function testNormalizationCalendar()

View File

@@ -59,7 +59,7 @@ final class BulkCalendarShortMessageSenderTest extends KernelTestCase
protected function tearDown(): void
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
foreach ($this->toDelete as [$entity, $id]) {
$entity = $em->find($entity, $id);
@@ -71,7 +71,7 @@ final class BulkCalendarShortMessageSenderTest extends KernelTestCase
public function testSendBulkMessageToEligibleCalendar()
{
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$calendar = new Calendar();
$calendar
->addPerson($this->getRandomPerson($em))