tests/ChillPersonBundle: in sf4 container is a static method of KernelTestCase

This commit is contained in:
Christophe Siraut 2021-04-26 09:03:28 +02:00
parent e4e2138765
commit f02d6df262

View File

@ -36,12 +36,6 @@ class PickPersonTypeTest extends KernelTestCase
*/ */
protected $user; protected $user;
/**
*
* @var \Symfony\Component\DependencyInjection\ContainerInterface
*/
protected $container;
/** /**
* *
* @var \Symfony\Component\Form\FormFactoryInterface * @var \Symfony\Component\Form\FormFactoryInterface
@ -52,16 +46,14 @@ class PickPersonTypeTest extends KernelTestCase
{ {
self::bootKernel(); self::bootKernel();
$this->container = self::$kernel->getContainer(); $this->user = self::$container->get('doctrine.orm.entity_manager')
$this->user = $this->container->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:User') ->getRepository('ChillMainBundle:User')
->findOneBy(array('username' => 'multi_center')); ->findOneBy(array('username' => 'multi_center'));
$this->formFactory = $this->container->get('form.factory'); $this->formFactory = self::$container->get('form.factory');
$token = (new UsernamePasswordToken($this->user, 'password', 'firewall')); $token = (new UsernamePasswordToken($this->user, 'password', 'firewall'));
$this->container->get('security.token_storage') self::$container->get('security.token_storage')
->setToken($token); ->setToken($token);
} }