Use FQCN instead of service alias

This commit is contained in:
Yassine Guedidi
2022-08-28 02:01:46 +02:00
parent 156158673f
commit eb43c78720
62 changed files with 579 additions and 404 deletions

View File

@ -2,8 +2,11 @@
namespace Tests\Wallabag\ApiBundle;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Wallabag\UserBundle\Entity\User;
abstract class WallabagApiTestCase extends WebTestCase
@ -41,10 +44,10 @@ abstract class WallabagApiTestCase extends WebTestCase
$loginManager->logInUser($firewallName, $this->user);
// save the login token into the session and put it in a cookie
$container->get('session')->set('_security_' . $firewallName, serialize($container->get('security.token_storage')->getToken()));
$container->get('session')->save();
$container->get(SessionInterface::class)->set('_security_' . $firewallName, serialize($container->get(TokenStorageInterface::class)->getToken()));
$container->get(SessionInterface::class)->save();
$session = $container->get('session');
$session = $container->get(SessionInterface::class);
$client->getCookieJar()->set(new Cookie($session->getName(), $session->getId()));
return $client;
@ -63,7 +66,7 @@ abstract class WallabagApiTestCase extends WebTestCase
{
return $this->client
->getContainer()
->get('doctrine.orm.entity_manager')
->get(EntityManagerInterface::class)
->getRepository(User::class)
->findOneByUserName($username)
->getId();