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,12 +2,15 @@
namespace Tests\Wallabag\CoreBundle;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Client;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Wallabag\CoreBundle\Entity\Config;
use Wallabag\UserBundle\Entity\User;
@ -70,7 +73,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
public function getEntityManager()
{
return $this->client->getContainer()->get('doctrine.orm.entity_manager');
return $this->client->getContainer()->get(EntityManagerInterface::class);
}
/**
@ -82,7 +85,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
public function logInAs($username)
{
$container = $this->client->getContainer();
$session = $container->get('session');
$session = $container->get(SessionInterface::class);
$userManager = $container->get('fos_user.user_manager.test');
$loginManager = $container->get('fos_user.security.login_manager.test');
@ -96,7 +99,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
$loginManager->logInUser($firewallName, $user);
$session->set('_security_' . $firewallName, serialize($container->get('security.token_storage')->getToken()));
$session->set('_security_' . $firewallName, serialize($container->get(TokenStorageInterface::class)->getToken()));
$session->save();
$cookie = new Cookie($session->getName(), $session->getId());
@ -129,7 +132,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
*/
public function getLoggedInUser()
{
$token = static::$kernel->getContainer()->get('security.token_storage')->getToken();
$token = static::$kernel->getContainer()->get(TokenStorageInterface::class)->getToken();
if (null !== $token) {
return $token->getUser();