mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-22 17:11:07 +00:00
Fix PHPStan errors
This commit is contained in:
parent
083dc630fb
commit
0178c7356d
28 changed files with 63 additions and 194 deletions
|
@ -1,10 +1,5 @@
|
||||||
parameters:
|
parameters:
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 3
|
|
||||||
path: src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Method Wallabag\\\\AnnotationBundle\\\\Controller\\\\WallabagAnnotationController\\:\\:postAnnotationAction\\(\\) should return Symfony\\\\Component\\\\HttpFoundation\\\\JsonResponse but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\<mixed\\>\\.$#"
|
message: "#^Method Wallabag\\\\AnnotationBundle\\\\Controller\\\\WallabagAnnotationController\\:\\:postAnnotationAction\\(\\) should return Symfony\\\\Component\\\\HttpFoundation\\\\JsonResponse but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\<mixed\\>\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -15,71 +10,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
|
path: src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getConfig\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Wallabag/ApiBundle/Controller/ConfigRestController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: src/Wallabag/ApiBundle/Controller/DeveloperController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 8
|
|
||||||
path: src/Wallabag/ApiBundle/Controller/EntryRestController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot assign new offset to string\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: src/Wallabag/ApiBundle/Controller/EntryRestController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Wallabag/ApiBundle/Controller/SearchRestController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 7
|
|
||||||
path: src/Wallabag/ApiBundle/Controller/TagRestController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getConfig\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Wallabag/ApiBundle/Controller/TaggingRuleRestController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getConfig\\(\\)\\.$#"
|
|
||||||
count: 3
|
|
||||||
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 11
|
|
||||||
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:setBackupCodes\\(\\)\\.$#"
|
|
||||||
count: 3
|
|
||||||
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:setEmailTwoFactor\\(\\)\\.$#"
|
|
||||||
count: 3
|
|
||||||
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:setGoogleAuthenticatorSecret\\(\\)\\.$#"
|
|
||||||
count: 3
|
|
||||||
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:setPlainPassword\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Call to an undefined method Wallabag\\\\CoreBundle\\\\Entity\\\\RuleInterface\\:\\:getConfig\\(\\)\\.$#"
|
message: "#^Call to an undefined method Wallabag\\\\CoreBundle\\\\Entity\\\\RuleInterface\\:\\:getConfig\\(\\)\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -90,26 +20,6 @@ parameters:
|
||||||
count: 6
|
count: 6
|
||||||
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
|
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 12
|
|
||||||
path: src/Wallabag/CoreBundle/Controller/EntryController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 6
|
|
||||||
path: src/Wallabag/CoreBundle/Controller/ExportController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Wallabag/CoreBundle/Controller/SiteCredentialController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 8
|
|
||||||
path: src/Wallabag/CoreBundle/Controller/TagController.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Call to an undefined method Spiriit\\\\Bundle\\\\FormFilterBundle\\\\Filter\\\\Query\\\\QueryInterface\\:\\:getExpressionBuilder\\(\\)\\.$#"
|
message: "#^Call to an undefined method Spiriit\\\\Bundle\\\\FormFilterBundle\\\\Filter\\\\Query\\\\QueryInterface\\:\\:getExpressionBuilder\\(\\)\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -120,16 +30,6 @@ parameters:
|
||||||
count: 10
|
count: 10
|
||||||
path: src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
|
path: src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method DOMNode\\:\\:getAttribute\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Wallabag/CoreBundle/Helper/DownloadImages.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Wallabag/ImportBundle/Controller/BrowserController.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#"
|
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -140,16 +40,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: src/Wallabag/ImportBundle/Controller/BrowserController.php
|
path: src/Wallabag/ImportBundle/Controller/BrowserController.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Wallabag/ImportBundle/Controller/DeliciousController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Wallabag/ImportBundle/Controller/HtmlController.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#"
|
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -160,31 +50,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: src/Wallabag/ImportBundle/Controller/HtmlController.php
|
path: src/Wallabag/ImportBundle/Controller/HtmlController.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Wallabag/ImportBundle/Controller/InstapaperController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Wallabag/ImportBundle/Controller/PinboardController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getConfig\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Wallabag/ImportBundle/Controller/PocketController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Wallabag/ImportBundle/Controller/ReadabilityController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Wallabag/ImportBundle/Controller/WallabagController.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#"
|
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
|
|
@ -15,6 +15,7 @@ use Wallabag\AnnotationBundle\Form\EditAnnotationType;
|
||||||
use Wallabag\AnnotationBundle\Form\NewAnnotationType;
|
use Wallabag\AnnotationBundle\Form\NewAnnotationType;
|
||||||
use Wallabag\AnnotationBundle\Repository\AnnotationRepository;
|
use Wallabag\AnnotationBundle\Repository\AnnotationRepository;
|
||||||
use Wallabag\CoreBundle\Entity\Entry;
|
use Wallabag\CoreBundle\Entity\Entry;
|
||||||
|
use Wallabag\UserBundle\Entity\User;
|
||||||
|
|
||||||
class WallabagAnnotationController extends AbstractFOSRestController
|
class WallabagAnnotationController extends AbstractFOSRestController
|
||||||
{
|
{
|
||||||
|
@ -146,6 +147,17 @@ class WallabagAnnotationController extends AbstractFOSRestController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return User|null
|
||||||
|
*/
|
||||||
|
protected function getUser()
|
||||||
|
{
|
||||||
|
$user = parent::getUser();
|
||||||
|
\assert(null === $user || $user instanceof User);
|
||||||
|
|
||||||
|
return $user;
|
||||||
|
}
|
||||||
|
|
||||||
private function validateAnnotation(AnnotationRepository $annotationRepository, int $annotationId, int $userId)
|
private function validateAnnotation(AnnotationRepository $annotationRepository, int $annotationId, int $userId)
|
||||||
{
|
{
|
||||||
$annotation = $annotationRepository->findOneByIdAndUserId($annotationId, $userId);
|
$annotation = $annotationRepository->findOneByIdAndUserId($annotationId, $userId);
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace Wallabag\ApiBundle\Controller;
|
namespace Wallabag\ApiBundle\Controller;
|
||||||
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
@ -12,6 +11,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
use Wallabag\ApiBundle\Entity\Client;
|
use Wallabag\ApiBundle\Entity\Client;
|
||||||
use Wallabag\ApiBundle\Form\Type\ClientType;
|
use Wallabag\ApiBundle\Form\Type\ClientType;
|
||||||
use Wallabag\ApiBundle\Repository\ClientRepository;
|
use Wallabag\ApiBundle\Repository\ClientRepository;
|
||||||
|
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||||
|
|
||||||
class DeveloperController extends AbstractController
|
class DeveloperController extends AbstractController
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,13 +93,13 @@ class EntryRestController extends WallabagRestController
|
||||||
|
|
||||||
$returnId = (null === $request->query->get('return_id')) ? false : (bool) $request->query->get('return_id');
|
$returnId = (null === $request->query->get('return_id')) ? false : (bool) $request->query->get('return_id');
|
||||||
|
|
||||||
$hashedUrls = $request->query->get('hashed_urls', []);
|
$hashedUrls = $request->query->all('hashed_urls');
|
||||||
$hashedUrl = $request->query->get('hashed_url', '');
|
$hashedUrl = $request->query->get('hashed_url', '');
|
||||||
if (!empty($hashedUrl)) {
|
if (!empty($hashedUrl)) {
|
||||||
$hashedUrls[] = $hashedUrl;
|
$hashedUrls[] = $hashedUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
$urls = $request->query->get('urls', []);
|
$urls = $request->query->all('urls');
|
||||||
$url = $request->query->get('url', '');
|
$url = $request->query->get('url', '');
|
||||||
if (!empty($url)) {
|
if (!empty($url)) {
|
||||||
$urls[] = $url;
|
$urls[] = $url;
|
||||||
|
|
|
@ -130,4 +130,15 @@ class WallabagRestController extends AbstractFOSRestController
|
||||||
|
|
||||||
return (new JsonResponse())->setJson($json);
|
return (new JsonResponse())->setJson($json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return User|null
|
||||||
|
*/
|
||||||
|
protected function getUser()
|
||||||
|
{
|
||||||
|
$user = parent::getUser();
|
||||||
|
\assert(null === $user || $user instanceof User);
|
||||||
|
|
||||||
|
return $user;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
20
src/Wallabag/CoreBundle/Controller/AbstractController.php
Normal file
20
src/Wallabag/CoreBundle/Controller/AbstractController.php
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Wallabag\CoreBundle\Controller;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController as BaseAbstractController;
|
||||||
|
use Wallabag\UserBundle\Entity\User;
|
||||||
|
|
||||||
|
abstract class AbstractController extends BaseAbstractController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return User|null
|
||||||
|
*/
|
||||||
|
protected function getUser()
|
||||||
|
{
|
||||||
|
$user = parent::getUser();
|
||||||
|
\assert(null === $user || $user instanceof User);
|
||||||
|
|
||||||
|
return $user;
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,7 +10,6 @@ use JMS\Serializer\SerializationContext;
|
||||||
use JMS\Serializer\SerializerBuilder;
|
use JMS\Serializer\SerializerBuilder;
|
||||||
use PragmaRX\Recovery\Recovery as BackupCodes;
|
use PragmaRX\Recovery\Recovery as BackupCodes;
|
||||||
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface;
|
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
|
|
|
@ -9,7 +9,6 @@ use Pagerfanta\Doctrine\ORM\QueryAdapter as DoctrineORMAdapter;
|
||||||
use Pagerfanta\Exception\OutOfRangeCurrentPageException;
|
use Pagerfanta\Exception\OutOfRangeCurrentPageException;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
|
||||||
use Spiriit\Bundle\FormFilterBundle\Filter\FilterBuilderUpdaterInterface;
|
use Spiriit\Bundle\FormFilterBundle\Filter\FilterBuilderUpdaterInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Wallabag\CoreBundle\Controller;
|
namespace Wallabag\CoreBundle\Controller;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
|
@ -7,7 +7,6 @@ use Pagerfanta\Doctrine\ORM\QueryAdapter as DoctrineORMAdapter;
|
||||||
use Pagerfanta\Exception\OutOfRangeCurrentPageException;
|
use Pagerfanta\Exception\OutOfRangeCurrentPageException;
|
||||||
use Pagerfanta\Pagerfanta;
|
use Pagerfanta\Pagerfanta;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace Wallabag\CoreBundle\Controller;
|
namespace Wallabag\CoreBundle\Controller;
|
||||||
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\Form\Form;
|
use Symfony\Component\Form\Form;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
|
|
|
@ -4,7 +4,6 @@ namespace Wallabag\CoreBundle\Controller;
|
||||||
|
|
||||||
use Craue\ConfigBundle\Util\Config;
|
use Craue\ConfigBundle\Util\Config;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\Form\Form;
|
use Symfony\Component\Form\Form;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Wallabag\CoreBundle\Controller;
|
namespace Wallabag\CoreBundle\Controller;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
class StaticController extends AbstractController
|
class StaticController extends AbstractController
|
||||||
|
|
|
@ -7,7 +7,6 @@ use Doctrine\ORM\QueryBuilder;
|
||||||
use Pagerfanta\Adapter\ArrayAdapter;
|
use Pagerfanta\Adapter\ArrayAdapter;
|
||||||
use Pagerfanta\Exception\OutOfRangeCurrentPageException;
|
use Pagerfanta\Exception\OutOfRangeCurrentPageException;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
|
@ -287,7 +287,10 @@ class DownloadImages
|
||||||
$iterator = $imagesCrawler->getIterator();
|
$iterator = $imagesCrawler->getIterator();
|
||||||
|
|
||||||
while ($iterator->valid()) {
|
while ($iterator->valid()) {
|
||||||
$srcsetAttribute = $iterator->current()->getAttribute('srcset');
|
$node = $iterator->current();
|
||||||
|
\assert($node instanceof \DOMElement);
|
||||||
|
|
||||||
|
$srcsetAttribute = $node->getAttribute('srcset');
|
||||||
|
|
||||||
if ('' !== $srcsetAttribute) {
|
if ('' !== $srcsetAttribute) {
|
||||||
// Couldn't start with " OR ' OR a white space
|
// Couldn't start with " OR ' OR a white space
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
namespace Wallabag\ImportBundle\Controller;
|
namespace Wallabag\ImportBundle\Controller;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||||
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
||||||
use Wallabag\ImportBundle\Import\ImportInterface;
|
use Wallabag\ImportBundle\Import\ImportInterface;
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ namespace Wallabag\ImportBundle\Controller;
|
||||||
|
|
||||||
use Craue\ConfigBundle\Util\Config;
|
use Craue\ConfigBundle\Util\Config;
|
||||||
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
|
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||||
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
||||||
use Wallabag\ImportBundle\Import\DeliciousImport;
|
use Wallabag\ImportBundle\Import\DeliciousImport;
|
||||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
namespace Wallabag\ImportBundle\Controller;
|
namespace Wallabag\ImportBundle\Controller;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||||
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
||||||
use Wallabag\ImportBundle\Import\ImportInterface;
|
use Wallabag\ImportBundle\Import\ImportInterface;
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ namespace Wallabag\ImportBundle\Controller;
|
||||||
|
|
||||||
use Craue\ConfigBundle\Util\Config;
|
use Craue\ConfigBundle\Util\Config;
|
||||||
use Predis\Client;
|
use Predis\Client;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||||
|
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||||
use Wallabag\ImportBundle\Consumer\RabbitMQConsumerTotalProxy;
|
use Wallabag\ImportBundle\Consumer\RabbitMQConsumerTotalProxy;
|
||||||
use Wallabag\ImportBundle\Import\ImportChain;
|
use Wallabag\ImportBundle\Import\ImportChain;
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ namespace Wallabag\ImportBundle\Controller;
|
||||||
|
|
||||||
use Craue\ConfigBundle\Util\Config;
|
use Craue\ConfigBundle\Util\Config;
|
||||||
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
|
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||||
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
||||||
use Wallabag\ImportBundle\Import\InstapaperImport;
|
use Wallabag\ImportBundle\Import\InstapaperImport;
|
||||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||||
|
|
|
@ -4,10 +4,10 @@ namespace Wallabag\ImportBundle\Controller;
|
||||||
|
|
||||||
use Craue\ConfigBundle\Util\Config;
|
use Craue\ConfigBundle\Util\Config;
|
||||||
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
|
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||||
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
||||||
use Wallabag\ImportBundle\Import\PinboardImport;
|
use Wallabag\ImportBundle\Import\PinboardImport;
|
||||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||||
|
|
|
@ -4,13 +4,13 @@ namespace Wallabag\ImportBundle\Controller;
|
||||||
|
|
||||||
use Craue\ConfigBundle\Util\Config;
|
use Craue\ConfigBundle\Util\Config;
|
||||||
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
|
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||||
use Wallabag\ImportBundle\Import\PocketImport;
|
use Wallabag\ImportBundle\Import\PocketImport;
|
||||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ namespace Wallabag\ImportBundle\Controller;
|
||||||
|
|
||||||
use Craue\ConfigBundle\Util\Config;
|
use Craue\ConfigBundle\Util\Config;
|
||||||
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
|
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||||
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
||||||
use Wallabag\ImportBundle\Import\ReadabilityImport;
|
use Wallabag\ImportBundle\Import\ReadabilityImport;
|
||||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
namespace Wallabag\ImportBundle\Controller;
|
namespace Wallabag\ImportBundle\Controller;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||||
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
||||||
use Wallabag\ImportBundle\Import\ImportInterface;
|
use Wallabag\ImportBundle\Import\ImportInterface;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ use Pagerfanta\Doctrine\ORM\QueryAdapter as DoctrineORMAdapter;
|
||||||
use Pagerfanta\Exception\OutOfRangeCurrentPageException;
|
use Pagerfanta\Exception\OutOfRangeCurrentPageException;
|
||||||
use Pagerfanta\Pagerfanta;
|
use Pagerfanta\Pagerfanta;
|
||||||
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface;
|
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\Form\Form;
|
use Symfony\Component\Form\Form;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
|
@ -18,6 +17,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||||
use Wallabag\UserBundle\Entity\User;
|
use Wallabag\UserBundle\Entity\User;
|
||||||
use Wallabag\UserBundle\Form\NewUserType;
|
use Wallabag\UserBundle\Form\NewUserType;
|
||||||
use Wallabag\UserBundle\Form\SearchUserType;
|
use Wallabag\UserBundle\Form\SearchUserType;
|
||||||
|
|
|
@ -4,12 +4,8 @@ namespace Tests\Wallabag\AnnotationBundle;
|
||||||
|
|
||||||
use FOS\UserBundle\Model\UserInterface;
|
use FOS\UserBundle\Model\UserInterface;
|
||||||
use FOS\UserBundle\Model\UserManager;
|
use FOS\UserBundle\Model\UserManager;
|
||||||
use FOS\UserBundle\Security\LoginManager;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
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
|
abstract class WallabagAnnotationTestCase extends WebTestCase
|
||||||
{
|
{
|
||||||
|
@ -51,19 +47,11 @@ abstract class WallabagAnnotationTestCase extends WebTestCase
|
||||||
|
|
||||||
/** @var UserManager $userManager */
|
/** @var UserManager $userManager */
|
||||||
$userManager = $container->get('fos_user.user_manager.test');
|
$userManager = $container->get('fos_user.user_manager.test');
|
||||||
/** @var LoginManager $loginManager */
|
|
||||||
$loginManager = $container->get('fos_user.security.login_manager.test');
|
|
||||||
$firewallName = $container->getParameter('fos_user.firewall_name');
|
$firewallName = $container->getParameter('fos_user.firewall_name');
|
||||||
|
|
||||||
$this->user = $userManager->findUserBy(['username' => 'admin']);
|
$this->user = $userManager->findUserBy(['username' => 'admin']);
|
||||||
$loginManager->logInUser($firewallName, $this->user);
|
|
||||||
|
|
||||||
// save the login token into the session and put it in a cookie
|
$client->loginUser($this->user, $firewallName);
|
||||||
$container->get(SessionInterface::class)->set('_security_' . $firewallName, serialize($container->get(TokenStorageInterface::class)->getToken()));
|
|
||||||
$container->get(SessionInterface::class)->save();
|
|
||||||
|
|
||||||
$session = $container->get(SessionInterface::class);
|
|
||||||
$client->getCookieJar()->set(new Cookie($session->getName(), $session->getId()));
|
|
||||||
|
|
||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,8 @@ namespace Tests\Wallabag\ApiBundle;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use FOS\UserBundle\Model\UserInterface;
|
use FOS\UserBundle\Model\UserInterface;
|
||||||
use FOS\UserBundle\Model\UserManager;
|
use FOS\UserBundle\Model\UserManager;
|
||||||
use FOS\UserBundle\Security\LoginManager;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
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;
|
use Wallabag\UserBundle\Entity\User;
|
||||||
|
|
||||||
abstract class WallabagApiTestCase extends WebTestCase
|
abstract class WallabagApiTestCase extends WebTestCase
|
||||||
|
@ -51,19 +47,11 @@ abstract class WallabagApiTestCase extends WebTestCase
|
||||||
|
|
||||||
/** @var UserManager $userManager */
|
/** @var UserManager $userManager */
|
||||||
$userManager = $container->get('fos_user.user_manager.test');
|
$userManager = $container->get('fos_user.user_manager.test');
|
||||||
/** @var LoginManager $loginManager */
|
|
||||||
$loginManager = $container->get('fos_user.security.login_manager.test');
|
|
||||||
$firewallName = $container->getParameter('fos_user.firewall_name');
|
$firewallName = $container->getParameter('fos_user.firewall_name');
|
||||||
|
|
||||||
$this->user = $userManager->findUserBy(['username' => 'admin']);
|
$this->user = $userManager->findUserBy(['username' => 'admin']);
|
||||||
$loginManager->logInUser($firewallName, $this->user);
|
|
||||||
|
|
||||||
// save the login token into the session and put it in a cookie
|
$client->loginUser($this->user, $firewallName);
|
||||||
$container->get(SessionInterface::class)->set('_security_' . $firewallName, serialize($container->get(TokenStorageInterface::class)->getToken()));
|
|
||||||
$container->get(SessionInterface::class)->save();
|
|
||||||
|
|
||||||
$session = $container->get(SessionInterface::class);
|
|
||||||
$client->getCookieJar()->set(new Cookie($session->getName(), $session->getId()));
|
|
||||||
|
|
||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,8 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
use Symfony\Component\BrowserKit\Cookie;
|
|
||||||
use Symfony\Component\Console\Input\ArrayInput;
|
use Symfony\Component\Console\Input\ArrayInput;
|
||||||
use Symfony\Component\Console\Output\NullOutput;
|
use Symfony\Component\Console\Output\NullOutput;
|
||||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Wallabag\UserBundle\Entity\User;
|
use Wallabag\UserBundle\Entity\User;
|
||||||
|
|
||||||
|
@ -88,10 +86,8 @@ abstract class WallabagCoreTestCase extends WebTestCase
|
||||||
public function logInAs($username)
|
public function logInAs($username)
|
||||||
{
|
{
|
||||||
$container = $this->client->getContainer();
|
$container = $this->client->getContainer();
|
||||||
$session = $container->get(SessionInterface::class);
|
|
||||||
|
|
||||||
$userManager = $container->get('fos_user.user_manager.test');
|
$userManager = $container->get('fos_user.user_manager.test');
|
||||||
$loginManager = $container->get('fos_user.security.login_manager.test');
|
|
||||||
$firewallName = $container->getParameter('fos_user.firewall_name');
|
$firewallName = $container->getParameter('fos_user.firewall_name');
|
||||||
|
|
||||||
$user = $userManager->findUserBy(['username' => $username]);
|
$user = $userManager->findUserBy(['username' => $username]);
|
||||||
|
@ -100,13 +96,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
|
||||||
throw new \Exception('Unable to find user "' . $username . '". Does fixtures were loaded?');
|
throw new \Exception('Unable to find user "' . $username . '". Does fixtures were loaded?');
|
||||||
}
|
}
|
||||||
|
|
||||||
$loginManager->logInUser($firewallName, $user);
|
$this->client->loginUser($user, $firewallName);
|
||||||
|
|
||||||
$session->set('_security_' . $firewallName, serialize($container->get(TokenStorageInterface::class)->getToken()));
|
|
||||||
$session->save();
|
|
||||||
|
|
||||||
$cookie = new Cookie($session->getName(), $session->getId());
|
|
||||||
$this->client->getCookieJar()->set($cookie);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue