From b2ff47072048a84eec6241f6c6c64f7c1a08c28e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 20 Apr 2021 15:29:54 +0200 Subject: [PATCH] fix container property overriding to non-static --- .../Tests/Export/ExportManagerTest.php | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php index 821baf448..a34327292 100644 --- a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php @@ -45,11 +45,6 @@ class ExportManagerTest extends KernelTestCase use \Chill\MainBundle\Test\PrepareUserTrait; use \Chill\MainBundle\Test\PrepareScopeTrait; - /** - * - * @var \Symfony\Component\DependencyInjection\ContainerInterface - */ - private $container; /** * @@ -65,8 +60,6 @@ class ExportManagerTest extends KernelTestCase { self::bootKernel(); - $this->container = self::$kernel->getContainer(); - $this->prophet = new \Prophecy\Prophet; } @@ -97,7 +90,7 @@ class ExportManagerTest extends KernelTestCase \Symfony\Component\Security\Core\User\UserInterface $user = null ) { - $localUser = $user === NULL ? $this->container->get('doctrine.orm.entity_manager') + $localUser = $user === NULL ? self::$container->get('doctrine.orm.entity_manager') ->getRepository('ChillMainBundle:User') ->findOneBy(array('username' => 'center a_social')) : $user; @@ -106,10 +99,10 @@ class ExportManagerTest extends KernelTestCase $tokenStorage->setToken($token); return new ExportManager( - $logger === NULL ? $this->container->get('logger') : $logger, - $em === NULL ? $this->container->get('doctrine.orm.entity_manager') : $em, - $authorizationChecker === NULL ? $this->container->get('security.authorization_checker') : $authorizationChecker, - $authorizationHelper === NULL ? $this->container->get('chill.main.security.authorization.helper') : $authorizationHelper, + $logger === NULL ? self::$container->get('logger') : $logger, + $em === NULL ? self::$container->get('doctrine.orm.entity_manager') : $em, + $authorizationChecker === NULL ? self::$container->get('security.authorization_checker') : $authorizationChecker, + $authorizationHelper === NULL ? self::$container->get('chill.main.security.authorization.helper') : $authorizationHelper, $tokenStorage) ; } @@ -544,7 +537,7 @@ class ExportManagerTest extends KernelTestCase $export = $this->prophet->prophesize(); $export->willImplement(ExportInterface::class); - $em = $this->container->get('doctrine.orm.entity_manager'); + $em = self::$container->get('doctrine.orm.entity_manager'); $export->initiateQuery( Argument::is(array('foo')), Argument::Type('array'), @@ -627,7 +620,7 @@ class ExportManagerTest extends KernelTestCase //add formatter interface $formatter = new \Chill\MainBundle\Export\Formatter\SpreadSheetFormatter( - $this->container->get('translator'), $exportManager); + self::$container->get('translator'), $exportManager); $exportManager->addFormatter($formatter, 'spreadsheet'); //ob_start();