mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix container operations within tests
This commit is contained in:
parent
92800f5dd0
commit
553fb271e4
@ -35,9 +35,9 @@ class ListActivitiesByAccompanyingPeriodContextTest extends KernelTestCase
|
|||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
$this->listActivitiesByAccompanyingPeriodContext = self::$container->get(ListActivitiesByAccompanyingPeriodContext::class);
|
$this->listActivitiesByAccompanyingPeriodContext = self::getContainer()->get(ListActivitiesByAccompanyingPeriodContext::class);
|
||||||
$this->accompanyingPeriodRepository = self::$container->get(AccompanyingPeriodRepository::class);
|
$this->accompanyingPeriodRepository = self::getContainer()->get(AccompanyingPeriodRepository::class);
|
||||||
$this->userRepository = self::$container->get(UserRepositoryInterface::class);
|
$this->userRepository = self::getContainer()->get(UserRepositoryInterface::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,7 +101,7 @@ class ListActivitiesByAccompanyingPeriodContextTest extends KernelTestCase
|
|||||||
public static function provideAccompanyingPeriod(): array
|
public static function provideAccompanyingPeriod(): array
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
if (null === $period = $em->createQuery('SELECT a FROM '.AccompanyingPeriod::class.' a')
|
if (null === $period = $em->createQuery('SELECT a FROM '.AccompanyingPeriod::class.' a')
|
||||||
->setMaxResults(1)
|
->setMaxResults(1)
|
||||||
|
@ -25,7 +25,7 @@ class RoleProvider
|
|||||||
/**
|
/**
|
||||||
* @var iterable<ProvideRoleInterface>
|
* @var iterable<ProvideRoleInterface>
|
||||||
*/
|
*/
|
||||||
private iterable $providers
|
private readonly iterable $providers
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function getRoles(): array
|
public function getRoles(): array
|
||||||
|
@ -42,7 +42,7 @@ class NewsItemControllerTest extends WebTestCase
|
|||||||
public static function tearDownAfterClass(): void
|
public static function tearDownAfterClass(): void
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
foreach (self::$entitiesToDelete as [$class, $id]) {
|
foreach (self::$entitiesToDelete as [$class, $id]) {
|
||||||
$entity = $em->find($class, $id);
|
$entity = $em->find($class, $id);
|
||||||
@ -58,7 +58,7 @@ class NewsItemControllerTest extends WebTestCase
|
|||||||
public static function generateNewsItemIds(): iterable
|
public static function generateNewsItemIds(): iterable
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
$newsItem = new NewsItem();
|
$newsItem = new NewsItem();
|
||||||
$newsItem->setTitle('Lorem Ipsum');
|
$newsItem->setTitle('Lorem Ipsum');
|
||||||
|
@ -33,7 +33,7 @@ class NewsItemsHistoryControllerTest extends WebTestCase
|
|||||||
public static function tearDownAfterClass(): void
|
public static function tearDownAfterClass(): void
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
foreach (static::$toDelete as [$class, $entity]) {
|
foreach (static::$toDelete as [$class, $entity]) {
|
||||||
$query = $em->createQuery(sprintf('DELETE FROM %s e WHERE e.id = :id', $class))
|
$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
|
public static function generateNewsItemIds(): iterable
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
$news = new NewsItem();
|
$news = new NewsItem();
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class NewsItemRepositoryTest extends KernelTestCase
|
|||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
$this->entityManager = self::$container->get(EntityManagerInterface::class);
|
$this->entityManager = self::getContainer()->get(EntityManagerInterface::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void
|
||||||
|
@ -30,7 +30,7 @@ final class WithEvaluationBetweenDatesFilterTest extends AbstractFilterTest
|
|||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
|
|
||||||
$this->filter = self::$container->get(AccompanyingPeriodWorkWithEvaluationBetweenDatesFilter::class);
|
$this->filter = self::getContainer()->get(AccompanyingPeriodWorkWithEvaluationBetweenDatesFilter::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFilter()
|
public function getFilter()
|
||||||
@ -52,7 +52,7 @@ final class WithEvaluationBetweenDatesFilterTest extends AbstractFilterTest
|
|||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
|
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
$em->createQueryBuilder()
|
$em->createQueryBuilder()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user