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;
/**
*
* @var \Symfony\Component\DependencyInjection\ContainerInterface
*/
protected $container;
/**
*
* @var \Symfony\Component\Form\FormFactoryInterface
@ -52,16 +46,14 @@ class PickPersonTypeTest extends KernelTestCase
{
self::bootKernel();
$this->container = self::$kernel->getContainer();
$this->user = $this->container->get('doctrine.orm.entity_manager')
$this->user = self::$container->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:User')
->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'));
$this->container->get('security.token_storage')
self::$container->get('security.token_storage')
->setToken($token);
}