aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-09-30 21:01:36 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-09-30 21:01:36 +0200
commitca17abce2d3963e266bee905ab084ddfa7e1ff18 (patch)
treece33b43a21acc99300d7046387f99d437f713785 /tests/Wallabag
parent114c55c0a6eade2ba6c53fe25f61cc58cca91620 (diff)
downloadwallabag-ca17abce2d3963e266bee905ab084ddfa7e1ff18.tar.gz
wallabag-ca17abce2d3963e266bee905ab084ddfa7e1ff18.tar.zst
wallabag-ca17abce2d3963e266bee905ab084ddfa7e1ff18.zip
Create user config in one place
Using a listener, user config is now created when a user: - is created from the command line - register (with or without email confirmation) - is created from the config panel
Diffstat (limited to 'tests/Wallabag')
-rw-r--r--tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php (renamed from tests/Wallabag/CoreBundle/EventListener/RegistrationConfirmedListenerTest.php)16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/Wallabag/CoreBundle/EventListener/RegistrationConfirmedListenerTest.php b/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php
index e45722fa..0cebd3e4 100644
--- a/tests/Wallabag/CoreBundle/EventListener/RegistrationConfirmedListenerTest.php
+++ b/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php
@@ -1,6 +1,6 @@
1<?php 1<?php
2 2
3namespace Tests\Wallabag\CoreBundle\EventListener; 3namespace Tests\Wallabag\UserBundle\EventListener;
4 4
5use FOS\UserBundle\Event\FilterUserResponseEvent; 5use FOS\UserBundle\Event\FilterUserResponseEvent;
6use FOS\UserBundle\FOSUserEvents; 6use FOS\UserBundle\FOSUserEvents;
@@ -8,10 +8,10 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
8use Symfony\Component\HttpFoundation\Request; 8use Symfony\Component\HttpFoundation\Request;
9use Symfony\Component\HttpFoundation\Response; 9use Symfony\Component\HttpFoundation\Response;
10use Wallabag\CoreBundle\Entity\Config; 10use Wallabag\CoreBundle\Entity\Config;
11use Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener; 11use Wallabag\UserBundle\EventListener\CreateConfigListener;
12use Wallabag\UserBundle\Entity\User; 12use Wallabag\UserBundle\Entity\User;
13 13
14class RegistrationConfirmedListenerTest extends \PHPUnit_Framework_TestCase 14class CreateConfigListenerTest extends \PHPUnit_Framework_TestCase
15{ 15{
16 private $em; 16 private $em;
17 private $listener; 17 private $listener;
@@ -25,12 +25,13 @@ class RegistrationConfirmedListenerTest extends \PHPUnit_Framework_TestCase
25 ->disableOriginalConstructor() 25 ->disableOriginalConstructor()
26 ->getMock(); 26 ->getMock();
27 27
28 $this->listener = new RegistrationConfirmedListener( 28 $this->listener = new CreateConfigListener(
29 $this->em, 29 $this->em,
30 'baggy', 30 'baggy',
31 20, 31 20,
32 50, 32 50,
33 'fr' 33 'fr',
34 1
34 ); 35 );
35 36
36 $this->dispatcher = new EventDispatcher(); 37 $this->dispatcher = new EventDispatcher();
@@ -55,7 +56,7 @@ class RegistrationConfirmedListenerTest extends \PHPUnit_Framework_TestCase
55 $this->em->expects($this->never())->method('flush'); 56 $this->em->expects($this->never())->method('flush');
56 57
57 $this->dispatcher->dispatch( 58 $this->dispatcher->dispatch(
58 FOSUserEvents::REGISTRATION_CONFIRMED, 59 FOSUserEvents::REGISTRATION_COMPLETED,
59 $event 60 $event
60 ); 61 );
61 } 62 }
@@ -76,6 +77,7 @@ class RegistrationConfirmedListenerTest extends \PHPUnit_Framework_TestCase
76 $config->setItemsPerPage(20); 77 $config->setItemsPerPage(20);
77 $config->setRssLimit(50); 78 $config->setRssLimit(50);
78 $config->setLanguage('fr'); 79 $config->setLanguage('fr');
80 $config->setReadingSpeed(1);
79 81
80 $this->em->expects($this->once()) 82 $this->em->expects($this->once())
81 ->method('persist') 83 ->method('persist')
@@ -84,7 +86,7 @@ class RegistrationConfirmedListenerTest extends \PHPUnit_Framework_TestCase
84 ->method('flush'); 86 ->method('flush');
85 87
86 $this->dispatcher->dispatch( 88 $this->dispatcher->dispatch(
87 FOSUserEvents::REGISTRATION_CONFIRMED, 89 FOSUserEvents::REGISTRATION_COMPLETED,
88 $event 90 $event
89 ); 91 );
90 } 92 }