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,6 +2,7 @@
namespace Tests\Wallabag\AnnotationBundle\Controller;
use Doctrine\ORM\EntityManagerInterface;
use Tests\Wallabag\AnnotationBundle\WallabagAnnotationTestCase;
use Wallabag\AnnotationBundle\Entity\Annotation;
use Wallabag\CoreBundle\Entity\Entry;
@ -29,7 +30,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
*/
public function testGetAnnotations($prefixUrl)
{
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
$user = $em
->getRepository(User::class)
@ -70,7 +71,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
*/
public function testSetAnnotation($prefixUrl)
{
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
if ('annotations' === $prefixUrl) {
$this->logInAs('admin');
@ -110,7 +111,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
public function testAllowEmptyQuote()
{
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
/** @var Entry $entry */
$entry = $em
@ -139,7 +140,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
public function testAllowOmmittedQuote()
{
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
/** @var Entry $entry */
$entry = $em
@ -170,7 +171,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
*/
public function testSetAnnotationWithQuoteTooLong($prefixUrl)
{
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
if ('annotations' === $prefixUrl) {
$this->logInAs('admin');
@ -202,7 +203,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
*/
public function testEditAnnotation($prefixUrl)
{
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
$user = $em
->getRepository(User::class)
@ -250,7 +251,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
*/
public function testDeleteAnnotation($prefixUrl)
{
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
$user = $em
->getRepository(User::class)

View File

@ -4,6 +4,8 @@ namespace Tests\Wallabag\AnnotationBundle;
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;
abstract class WallabagAnnotationTestCase extends WebTestCase
{
@ -52,10 +54,10 @@ abstract class WallabagAnnotationTestCase 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;