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

@@ -28,7 +28,7 @@ class CollateAddressWithReferenceOrPostalCodeTest extends KernelTestCase
protected function setUp(): void
{
self::bootKernel();
$this->connection = self::$container->get(Connection::class);
$this->connection = self::getContainer()->get(Connection::class);
}
public function testRun(): void

View File

@@ -66,7 +66,7 @@ final class RefreshAddressToGeographicalUnitMaterializedViewCronJobTest extends
self::bootKernel();
$job = new \Chill\MainBundle\Service\AddressGeographicalUnit\RefreshAddressToGeographicalUnitMaterializedViewCronJob(
self::$container->get(Connection::class),
self::getContainer()->get(Connection::class),
new MockClock()
);

View File

@@ -38,10 +38,10 @@ final class AddressReferenceBaseImporterTest extends KernelTestCase
parent::setUp();
self::bootKernel();
$this->importer = self::$container->get(AddressReferenceBaseImporter::class);
$this->addressReferenceRepository = self::$container->get(AddressReferenceRepository::class);
$this->entityManager = self::$container->get(EntityManagerInterface::class);
$this->postalCodeRepository = self::$container->get(PostalCodeRepository::class);
$this->importer = self::getContainer()->get(AddressReferenceBaseImporter::class);
$this->addressReferenceRepository = self::getContainer()->get(AddressReferenceRepository::class);
$this->entityManager = self::getContainer()->get(EntityManagerInterface::class);
$this->postalCodeRepository = self::getContainer()->get(PostalCodeRepository::class);
}
public function testImportAddress(): void

View File

@@ -42,11 +42,11 @@ class AddressToReferenceMatcherTest extends KernelTestCase
parent::setUp();
self::bootKernel();
$this->addressToReferenceMatcher = self::$container->get(AddressToReferenceMatcher::class);
$this->addressReferenceRepository = self::$container->get(AddressReferenceRepository::class);
$this->countryRepository = self::$container->get(CountryRepository::class);
$this->addressReferenceBaseImporter = self::$container->get(AddressReferenceBaseImporter::class);
$this->entityManager = self::$container->get(EntityManagerInterface::class);
$this->addressToReferenceMatcher = self::getContainer()->get(AddressToReferenceMatcher::class);
$this->addressReferenceRepository = self::getContainer()->get(AddressReferenceRepository::class);
$this->countryRepository = self::getContainer()->get(CountryRepository::class);
$this->addressReferenceBaseImporter = self::getContainer()->get(AddressReferenceBaseImporter::class);
$this->entityManager = self::getContainer()->get(EntityManagerInterface::class);
}
public function testCheckAddressesMatchingReferences(): void

View File

@@ -34,8 +34,8 @@ final class GeographicalUnitBaseImporterTest extends KernelTestCase
self::bootKernel();
$this->connection = self::$container->get(Connection::class);
$this->entityManager = self::$container->get(EntityManagerInterface::class);
$this->connection = self::getContainer()->get(Connection::class);
$this->entityManager = self::getContainer()->get(EntityManagerInterface::class);
}
public function testImportUnit(): void

View File

@@ -38,10 +38,10 @@ final class PostalCodeBaseImporterTest extends KernelTestCase
self::bootKernel();
$this->entityManager = self::$container->get(EntityManagerInterface::class);
$this->importer = self::$container->get(PostalCodeBaseImporter::class);
$this->postalCodeRepository = self::$container->get(PostalCodeRepository::class);
$this->countryRepository = self::$container->get(CountryRepository::class);
$this->entityManager = self::getContainer()->get(EntityManagerInterface::class);
$this->importer = self::getContainer()->get(PostalCodeBaseImporter::class);
$this->postalCodeRepository = self::getContainer()->get(PostalCodeRepository::class);
$this->countryRepository = self::getContainer()->get(CountryRepository::class);
}
public function testImportPostalCode(): void

View File

@@ -36,7 +36,7 @@ final class MenuComposerTest extends KernelTestCase
protected function setUp(): void
{
self::bootKernel(['environment' => 'test']);
$this->menuComposer = self::$container
$this->menuComposer = self::getContainer()
->get('chill.main.menu_composer');
}