mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 15:43:51 +00:00
fix container operations within tests
This commit is contained in:
@@ -25,7 +25,7 @@ class RoleProvider
|
||||
/**
|
||||
* @var iterable<ProvideRoleInterface>
|
||||
*/
|
||||
private iterable $providers
|
||||
private readonly iterable $providers
|
||||
) {}
|
||||
|
||||
public function getRoles(): array
|
||||
|
@@ -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');
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user