]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php
CS
[github/wallabag/wallabag.git] / tests / Wallabag / UserBundle / EventListener / CreateConfigListenerTest.php
index e5a145b835b4403fd35022763dd4a96ee72f52c1..d976c4ac6b0a2d974b9b496261bd84760deedbe2 100644 (file)
@@ -4,14 +4,17 @@ namespace Tests\Wallabag\UserBundle\EventListener;
 
 use FOS\UserBundle\Event\FilterUserResponseEvent;
 use FOS\UserBundle\FOSUserEvents;
+use PHPUnit\Framework\TestCase;
 use Symfony\Component\EventDispatcher\EventDispatcher;
 use Symfony\Component\HttpFoundation\Request;
 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\UserBundle\Entity\User;
 use Wallabag\UserBundle\EventListener\CreateConfigListener;
 
-class CreateConfigListenerTest extends \PHPUnit_Framework_TestCase
+class CreateConfigListenerTest extends TestCase
 {
     private $em;
     private $listener;
@@ -21,6 +24,7 @@ class CreateConfigListenerTest extends \PHPUnit_Framework_TestCase
 
     protected function setUp()
     {
+        $session = new Session(new MockArraySessionStorage());
         $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
             ->disableOriginalConstructor()
             ->getMock();
@@ -33,7 +37,8 @@ class CreateConfigListenerTest extends \PHPUnit_Framework_TestCase
             'fr',
             1,
             1,
-            1
+            1,
+            $session
         );
 
         $this->dispatcher = new EventDispatcher();
@@ -57,13 +62,13 @@ class CreateConfigListenerTest extends \PHPUnit_Framework_TestCase
         $config = new Config($user);
         $config->setTheme('baggy');
         $config->setItemsPerPage(20);
-        $config->setRssLimit(50);
+        $config->setFeedLimit(50);
         $config->setLanguage('fr');
         $config->setReadingSpeed(1);
 
         $this->em->expects($this->once())
             ->method('persist')
-            ->will($this->returnValue($config));
+            ->willReturn($config);
         $this->em->expects($this->once())
             ->method('flush');