fix container operations within tests

This commit is contained in:
2024-04-04 22:26:42 +02:00
parent 92800f5dd0
commit 553fb271e4
6 changed files with 12 additions and 12 deletions

View File

@@ -25,7 +25,7 @@ class RoleProvider
/**
* @var iterable<ProvideRoleInterface>
*/
private iterable $providers
private readonly iterable $providers
) {}
public function getRoles(): array

View File

@@ -42,7 +42,7 @@ class NewsItemControllerTest extends WebTestCase
public static function tearDownAfterClass(): void
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
foreach (self::$entitiesToDelete as [$class, $id]) {
$entity = $em->find($class, $id);
@@ -58,7 +58,7 @@ class NewsItemControllerTest extends WebTestCase
public static function generateNewsItemIds(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$newsItem = new NewsItem();
$newsItem->setTitle('Lorem Ipsum');

View File

@@ -33,7 +33,7 @@ class NewsItemsHistoryControllerTest extends WebTestCase
public static function tearDownAfterClass(): void
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
foreach (static::$toDelete as [$class, $entity]) {
$query = $em->createQuery(sprintf('DELETE FROM %s e WHERE e.id = :id', $class))
@@ -54,7 +54,7 @@ class NewsItemsHistoryControllerTest extends WebTestCase
public static function generateNewsItemIds(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$news = new NewsItem();

View File

@@ -35,7 +35,7 @@ class NewsItemRepositoryTest extends KernelTestCase
protected function setUp(): void
{
self::bootKernel();
$this->entityManager = self::$container->get(EntityManagerInterface::class);
$this->entityManager = self::getContainer()->get(EntityManagerInterface::class);
}
protected function tearDown(): void