fix container property overriding to non-static

This commit is contained in:
Julien Fastré 2021-04-20 15:29:54 +02:00
parent e9674dd334
commit b2ff470720

View File

@ -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();