1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-11 17:51:02 +00:00

Fix CreateConfigListener to not use session in CLI context

This commit is contained in:
Yassine Guedidi 2024-01-21 13:21:00 +01:00
parent 1a5e63a1b8
commit c93c47cdec
2 changed files with 18 additions and 9 deletions

View file

@ -8,9 +8,8 @@ use FOS\UserBundle\FOSUserEvents;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Wallabag\CoreBundle\Entity\Config;
use Wallabag\CoreBundle\Entity\User;
use Wallabag\CoreBundle\Event\Listener\CreateConfigListener;
@ -22,13 +21,16 @@ class CreateConfigListenerTest extends TestCase
private $dispatcher;
private $request;
private $response;
private $requestStack;
protected function setUp(): void
{
$session = new Session(new MockArraySessionStorage());
$this->em = $this->getMockBuilder(EntityManager::class)
->disableOriginalConstructor()
->getMock();
$this->requestStack = $this->getMockBuilder(RequestStack::class)
->disableOriginalConstructor()
->getMock();
$this->listener = new CreateConfigListener(
$this->em,
@ -39,7 +41,7 @@ class CreateConfigListenerTest extends TestCase
1,
1,
1,
$session
$this->requestStack
);
$this->dispatcher = new EventDispatcher();