diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-10-02 14:51:41 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-10-03 13:31:48 +0200 |
commit | 1210dae10589515d6f3824c75639342c5e1d52dd (patch) | |
tree | a26f0401a6f980f3ef96d3dc76ff3303b2943720 /src/Wallabag/CoreBundle/Tests | |
parent | 772d8c4b93adc36baefda93ec37007e4a85321de (diff) | |
download | wallabag-1210dae10589515d6f3824c75639342c5e1d52dd.tar.gz wallabag-1210dae10589515d6f3824c75639342c5e1d52dd.tar.zst wallabag-1210dae10589515d6f3824c75639342c5e1d52dd.zip |
remove old implementation for login/register/recover
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests')
6 files changed, 20 insertions, 339 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php index 708a07b1..3da5e8b7 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php | |||
@@ -354,7 +354,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
354 | 354 | ||
355 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); | 355 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); |
356 | $user = $em | 356 | $user = $em |
357 | ->getRepository('WallabagCoreBundle:User') | 357 | ->getRepository('WallabagUserBundle:User') |
358 | ->findOneByUsername('wallace'); | 358 | ->findOneByUsername('wallace'); |
359 | 359 | ||
360 | $this->assertTrue(false !== $user); | 360 | $this->assertTrue(false !== $user); |
@@ -369,7 +369,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
369 | // reset the token | 369 | // reset the token |
370 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); | 370 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); |
371 | $user = $em | 371 | $user = $em |
372 | ->getRepository('WallabagCoreBundle:User') | 372 | ->getRepository('WallabagUserBundle:User') |
373 | ->findOneByUsername('admin'); | 373 | ->findOneByUsername('admin'); |
374 | 374 | ||
375 | if (!$user) { | 375 | if (!$user) { |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/RssControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/RssControllerTest.php index b7c162a7..45a74c43 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/RssControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/RssControllerTest.php | |||
@@ -64,7 +64,7 @@ class RssControllerTest extends WallabagCoreTestCase | |||
64 | $client = $this->getClient(); | 64 | $client = $this->getClient(); |
65 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); | 65 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); |
66 | $user = $em | 66 | $user = $em |
67 | ->getRepository('WallabagCoreBundle:User') | 67 | ->getRepository('WallabagUserBundle:User') |
68 | ->findOneByUsername('admin'); | 68 | ->findOneByUsername('admin'); |
69 | 69 | ||
70 | $config = $user->getConfig(); | 70 | $config = $user->getConfig(); |
@@ -85,7 +85,7 @@ class RssControllerTest extends WallabagCoreTestCase | |||
85 | $client = $this->getClient(); | 85 | $client = $this->getClient(); |
86 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); | 86 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); |
87 | $user = $em | 87 | $user = $em |
88 | ->getRepository('WallabagCoreBundle:User') | 88 | ->getRepository('WallabagUserBundle:User') |
89 | ->findOneByUsername('admin'); | 89 | ->findOneByUsername('admin'); |
90 | 90 | ||
91 | $config = $user->getConfig(); | 91 | $config = $user->getConfig(); |
@@ -107,7 +107,7 @@ class RssControllerTest extends WallabagCoreTestCase | |||
107 | $client = $this->getClient(); | 107 | $client = $this->getClient(); |
108 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); | 108 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); |
109 | $user = $em | 109 | $user = $em |
110 | ->getRepository('WallabagCoreBundle:User') | 110 | ->getRepository('WallabagUserBundle:User') |
111 | ->findOneByUsername('admin'); | 111 | ->findOneByUsername('admin'); |
112 | 112 | ||
113 | $config = $user->getConfig(); | 113 | $config = $user->getConfig(); |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php deleted file mode 100644 index 7af9d5c4..00000000 --- a/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php +++ /dev/null | |||
@@ -1,319 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Tests\Controller; | ||
4 | |||
5 | use Symfony\Component\Filesystem\Filesystem; | ||
6 | use Symfony\Component\Finder\Finder; | ||
7 | use Wallabag\CoreBundle\Tests\WallabagCoreTestCase; | ||
8 | |||
9 | class SecurityControllerTest extends WallabagCoreTestCase | ||
10 | { | ||
11 | public function testRegister() | ||
12 | { | ||
13 | $client = $this->getClient(); | ||
14 | |||
15 | $crawler = $client->request('GET', '/register/'); | ||
16 | |||
17 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
18 | $this->assertContains('Register', $client->getResponse()->getContent()); | ||
19 | } | ||
20 | |||
21 | public function dataForCreateAccountFailed() | ||
22 | { | ||
23 | return array( | ||
24 | array( | ||
25 | array( | ||
26 | 'fos_user_registration_form[email]' => '', | ||
27 | 'fos_user_registration_form[username]' => 'newuser', | ||
28 | 'fos_user_registration_form[plainPassword][first]' => 'mypassword', | ||
29 | 'fos_user_registration_form[plainPassword][second]' => 'mypassword', | ||
30 | ), | ||
31 | 'Please enter an email', | ||
32 | ), | ||
33 | array( | ||
34 | array( | ||
35 | 'fos_user_registration_form[email]' => 'newuser@wallabag.org', | ||
36 | 'fos_user_registration_form[username]' => 'admin', | ||
37 | 'fos_user_registration_form[plainPassword][first]' => 'mypassword', | ||
38 | 'fos_user_registration_form[plainPassword][second]' => 'mypassword', | ||
39 | ), | ||
40 | 'The username is already used', | ||
41 | ), | ||
42 | array( | ||
43 | array( | ||
44 | 'fos_user_registration_form[email]' => 'newuser@wallabag.org', | ||
45 | 'fos_user_registration_form[username]' => 'newuser', | ||
46 | 'fos_user_registration_form[plainPassword][first]' => 'mypassword1', | ||
47 | 'fos_user_registration_form[plainPassword][second]' => 'mypassword2', | ||
48 | ), | ||
49 | 'The entered passwords don't match', | ||
50 | ), | ||
51 | ); | ||
52 | } | ||
53 | |||
54 | /** | ||
55 | * @dataProvider dataForCreateAccountFailed | ||
56 | */ | ||
57 | public function testCreateAccountFailed($data, $expectedMessage) | ||
58 | { | ||
59 | $client = $this->getClient(); | ||
60 | |||
61 | $crawler = $client->request('GET', '/register/'); | ||
62 | |||
63 | $form = $crawler->filter('input[type=submit]')->form(); | ||
64 | |||
65 | $client->submit($form, $data); | ||
66 | |||
67 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
68 | $this->assertContains($expectedMessage, $client->getResponse()->getContent()); | ||
69 | } | ||
70 | |||
71 | public function dataForCreateAccountSuccess() | ||
72 | { | ||
73 | return array( | ||
74 | array( | ||
75 | array( | ||
76 | 'fos_user_registration_form[email]' => 'newuser@wallabag.org', | ||
77 | 'fos_user_registration_form[username]' => 'newuser', | ||
78 | 'fos_user_registration_form[plainPassword][first]' => 'mypassword', | ||
79 | 'fos_user_registration_form[plainPassword][second]' => 'mypassword', | ||
80 | ), | ||
81 | ), | ||
82 | ); | ||
83 | } | ||
84 | |||
85 | /** | ||
86 | * @dataProvider dataForCreateAccountSuccess | ||
87 | */ | ||
88 | public function testCreateAccountSuccess($data) | ||
89 | { | ||
90 | $client = $this->getClient(); | ||
91 | |||
92 | $crawler = $client->request('GET', '/register/'); | ||
93 | |||
94 | $form = $crawler->filter('input[type=submit]')->form(); | ||
95 | |||
96 | $client->submit($form, $data); | ||
97 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
98 | |||
99 | $crawler = $client->followRedirect(); | ||
100 | |||
101 | $this->assertContains('The user has been created successfully', $client->getResponse()->getContent()); | ||
102 | } | ||
103 | |||
104 | public function testRegistrationConfirmation() | ||
105 | { | ||
106 | $client = $this->getClient(); | ||
107 | $client->followRedirects(); | ||
108 | |||
109 | $user = $client->getContainer() | ||
110 | ->get('doctrine.orm.entity_manager') | ||
111 | ->getRepository('WallabagCoreBundle:User') | ||
112 | ->findOneByUsername('newuser'); | ||
113 | |||
114 | $this->assertNull($user->getConfig()); | ||
115 | |||
116 | $client->request('GET', '/register/confirm/b4dT0k3n'); | ||
117 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | ||
118 | |||
119 | $crawler = $client->request('GET', '/register/confirm/'.$user->getConfirmationToken()); | ||
120 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
121 | |||
122 | $user = $client->getContainer() | ||
123 | ->get('doctrine.orm.entity_manager') | ||
124 | ->getRepository('WallabagCoreBundle:User') | ||
125 | ->findOneByUsername('newuser'); | ||
126 | $this->assertNotNull($user->getConfig()); | ||
127 | } | ||
128 | |||
129 | public function testLogin() | ||
130 | { | ||
131 | $client = $this->getClient(); | ||
132 | |||
133 | $crawler = $client->request('GET', '/new'); | ||
134 | |||
135 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
136 | $this->assertContains('login', $client->getResponse()->headers->get('location')); | ||
137 | } | ||
138 | |||
139 | public function testLoginFail() | ||
140 | { | ||
141 | $client = $this->getClient(); | ||
142 | |||
143 | $crawler = $client->request('GET', '/login'); | ||
144 | |||
145 | $form = $crawler->filter('button[type=submit]')->form(); | ||
146 | $data = array( | ||
147 | '_username' => 'admin', | ||
148 | '_password' => 'admin', | ||
149 | ); | ||
150 | |||
151 | $client->submit($form, $data); | ||
152 | |||
153 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
154 | $this->assertContains('login', $client->getResponse()->headers->get('location')); | ||
155 | |||
156 | $crawler = $client->followRedirect(); | ||
157 | |||
158 | $this->assertContains('Bad credentials', $client->getResponse()->getContent()); | ||
159 | } | ||
160 | |||
161 | public function testRedirectionAfterLogin() | ||
162 | { | ||
163 | $client = $this->getClient(); | ||
164 | $client->followRedirects(); | ||
165 | |||
166 | $crawler = $client->request('GET', '/config'); | ||
167 | |||
168 | $form = $crawler->filter('button[type=submit]')->form(); | ||
169 | |||
170 | $data = array( | ||
171 | '_username' => 'admin', | ||
172 | '_password' => 'mypassword', | ||
173 | ); | ||
174 | |||
175 | $client->submit($form, $data); | ||
176 | |||
177 | $this->assertContains('RSS', $client->getResponse()->getContent()); | ||
178 | } | ||
179 | |||
180 | public function testForgotPassword() | ||
181 | { | ||
182 | $client = $this->getClient(); | ||
183 | |||
184 | $crawler = $client->request('GET', '/forgot-password'); | ||
185 | |||
186 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
187 | |||
188 | $this->assertContains('Forgot password', $client->getResponse()->getContent()); | ||
189 | |||
190 | $form = $crawler->filter('button[type=submit]'); | ||
191 | |||
192 | $this->assertCount(1, $form); | ||
193 | |||
194 | return array( | ||
195 | 'form' => $form->form(), | ||
196 | 'client' => $client, | ||
197 | ); | ||
198 | } | ||
199 | |||
200 | /** | ||
201 | * @depends testForgotPassword | ||
202 | */ | ||
203 | public function testSubmitForgotPasswordFail($parameters) | ||
204 | { | ||
205 | $form = $parameters['form']; | ||
206 | $client = $parameters['client']; | ||
207 | |||
208 | $data = array( | ||
209 | 'forgot_password[email]' => 'material', | ||
210 | ); | ||
211 | |||
212 | $client->submit($form, $data); | ||
213 | |||
214 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
215 | $this->assertContains('No user found with this email', $client->getResponse()->getContent()); | ||
216 | } | ||
217 | |||
218 | /** | ||
219 | * @depends testForgotPassword | ||
220 | * | ||
221 | * Instead of using collector which slow down the test suite | ||
222 | * http://symfony.com/doc/current/cookbook/email/testing.html | ||
223 | * | ||
224 | * Use a different way where Swift store email as file | ||
225 | */ | ||
226 | public function testSubmitForgotPassword($parameters) | ||
227 | { | ||
228 | $form = $parameters['form']; | ||
229 | $client = $parameters['client']; | ||
230 | |||
231 | $spoolDir = $client->getKernel()->getContainer()->getParameter('swiftmailer.spool.default.file.path'); | ||
232 | |||
233 | // cleanup pool dir | ||
234 | $filesystem = new Filesystem(); | ||
235 | $filesystem->remove($spoolDir); | ||
236 | |||
237 | // to use `getCollector` since `collect: false` in config_test.yml | ||
238 | $client->enableProfiler(); | ||
239 | |||
240 | $data = array( | ||
241 | 'forgot_password[email]' => 'bobby@wallabag.org', | ||
242 | ); | ||
243 | |||
244 | $client->submit($form, $data); | ||
245 | |||
246 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
247 | |||
248 | $crawler = $client->followRedirect(); | ||
249 | |||
250 | $this->assertContains('An email has been sent to', $client->getResponse()->getContent()); | ||
251 | |||
252 | // find every files (ie: emails) inside the spool dir except hidden files | ||
253 | $finder = new Finder(); | ||
254 | $finder | ||
255 | ->in($spoolDir) | ||
256 | ->ignoreDotFiles(true) | ||
257 | ->files(); | ||
258 | |||
259 | $this->assertCount(1, $finder, 'Only one email has been sent'); | ||
260 | |||
261 | foreach ($finder as $file) { | ||
262 | $message = unserialize(file_get_contents($file)); | ||
263 | |||
264 | $this->assertInstanceOf('Swift_Message', $message); | ||
265 | $this->assertEquals('Reset Password', $message->getSubject()); | ||
266 | $this->assertEquals('no-reply@wallabag.org', key($message->getFrom())); | ||
267 | $this->assertEquals('bobby@wallabag.org', key($message->getTo())); | ||
268 | $this->assertContains( | ||
269 | 'To reset your password - please visit', | ||
270 | $message->getBody() | ||
271 | ); | ||
272 | } | ||
273 | } | ||
274 | |||
275 | public function testReset() | ||
276 | { | ||
277 | $client = $this->getClient(); | ||
278 | $user = $client->getContainer() | ||
279 | ->get('doctrine.orm.entity_manager') | ||
280 | ->getRepository('WallabagCoreBundle:User') | ||
281 | ->findOneByEmail('bobby@wallabag.org'); | ||
282 | |||
283 | $crawler = $client->request('GET', '/forgot-password/'.$user->getConfirmationToken()); | ||
284 | |||
285 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
286 | $this->assertCount(2, $crawler->filter('input[type=password]')); | ||
287 | $this->assertCount(1, $form = $crawler->filter('button[type=submit]')); | ||
288 | $this->assertCount(1, $form); | ||
289 | |||
290 | $data = array( | ||
291 | 'change_passwd[new_password][first]' => 'mypassword', | ||
292 | 'change_passwd[new_password][second]' => 'mypassword', | ||
293 | ); | ||
294 | |||
295 | $client->submit($form->form(), $data); | ||
296 | |||
297 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
298 | $this->assertContains('login', $client->getResponse()->headers->get('location')); | ||
299 | } | ||
300 | |||
301 | public function testResetBadToken() | ||
302 | { | ||
303 | $client = $this->getClient(); | ||
304 | |||
305 | $client->request('GET', '/forgot-password/UIZOAU29UE902IEPZO'); | ||
306 | |||
307 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | ||
308 | } | ||
309 | |||
310 | public function testCheckEmailWithoutEmail() | ||
311 | { | ||
312 | $client = $this->getClient(); | ||
313 | |||
314 | $client->request('GET', '/forgot-password/check-email'); | ||
315 | |||
316 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
317 | $this->assertContains('forgot-password', $client->getResponse()->headers->get('location')); | ||
318 | } | ||
319 | } | ||
diff --git a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php index 0d338389..1d0d4062 100644 --- a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php +++ b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php | |||
@@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\Tests\Helper; | |||
4 | 4 | ||
5 | use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | 5 | use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; |
6 | use Wallabag\CoreBundle\Entity\Entry; | 6 | use Wallabag\CoreBundle\Entity\Entry; |
7 | use Wallabag\CoreBundle\Entity\User; | 7 | use Wallabag\UserBundle\Entity\User; |
8 | use Wallabag\CoreBundle\Helper\ContentProxy; | 8 | use Wallabag\CoreBundle\Helper\ContentProxy; |
9 | 9 | ||
10 | class ContentProxyTest extends KernelTestCase | 10 | class ContentProxyTest extends KernelTestCase |
diff --git a/src/Wallabag/CoreBundle/Tests/ParamConverter/UsernameRssTokenConverterTest.php b/src/Wallabag/CoreBundle/Tests/ParamConverter/UsernameRssTokenConverterTest.php index ebb550b5..e28dc4ba 100644 --- a/src/Wallabag/CoreBundle/Tests/ParamConverter/UsernameRssTokenConverterTest.php +++ b/src/Wallabag/CoreBundle/Tests/ParamConverter/UsernameRssTokenConverterTest.php | |||
@@ -6,7 +6,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | |||
6 | use Wallabag\CoreBundle\ParamConverter\UsernameRssTokenConverter; | 6 | use Wallabag\CoreBundle\ParamConverter\UsernameRssTokenConverter; |
7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; | 7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; |
8 | use Symfony\Component\HttpFoundation\Request; | 8 | use Symfony\Component\HttpFoundation\Request; |
9 | use Wallabag\CoreBundle\Entity\User; | 9 | use Wallabag\UserBundle\Entity\User; |
10 | 10 | ||
11 | class UsernameRssTokenConverterTest extends KernelTestCase | 11 | class UsernameRssTokenConverterTest extends KernelTestCase |
12 | { | 12 | { |
@@ -96,7 +96,7 @@ class UsernameRssTokenConverterTest extends KernelTestCase | |||
96 | 96 | ||
97 | $meta->expects($this->once()) | 97 | $meta->expects($this->once()) |
98 | ->method('getName') | 98 | ->method('getName') |
99 | ->will($this->returnValue('Wallabag\CoreBundle\Entity\User')); | 99 | ->will($this->returnValue('Wallabag\UserBundle\Entity\User')); |
100 | 100 | ||
101 | $em = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager') | 101 | $em = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager') |
102 | ->disableOriginalConstructor() | 102 | ->disableOriginalConstructor() |
@@ -104,7 +104,7 @@ class UsernameRssTokenConverterTest extends KernelTestCase | |||
104 | 104 | ||
105 | $em->expects($this->once()) | 105 | $em->expects($this->once()) |
106 | ->method('getClassMetadata') | 106 | ->method('getClassMetadata') |
107 | ->with('WallabagCoreBundle:User') | 107 | ->with('WallabagUserBundle:User') |
108 | ->will($this->returnValue($meta)); | 108 | ->will($this->returnValue($meta)); |
109 | 109 | ||
110 | $registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry') | 110 | $registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry') |
@@ -117,10 +117,10 @@ class UsernameRssTokenConverterTest extends KernelTestCase | |||
117 | 117 | ||
118 | $registry->expects($this->once()) | 118 | $registry->expects($this->once()) |
119 | ->method('getManagerForClass') | 119 | ->method('getManagerForClass') |
120 | ->with('WallabagCoreBundle:User') | 120 | ->with('WallabagUserBundle:User') |
121 | ->will($this->returnValue($em)); | 121 | ->will($this->returnValue($em)); |
122 | 122 | ||
123 | $params = new ParamConverter(array('class' => 'WallabagCoreBundle:User')); | 123 | $params = new ParamConverter(array('class' => 'WallabagUserBundle:User')); |
124 | $converter = new UsernameRssTokenConverter($registry); | 124 | $converter = new UsernameRssTokenConverter($registry); |
125 | 125 | ||
126 | $this->assertTrue($converter->supports($params)); | 126 | $this->assertTrue($converter->supports($params)); |
@@ -144,7 +144,7 @@ class UsernameRssTokenConverterTest extends KernelTestCase | |||
144 | */ | 144 | */ |
145 | public function testApplyUserNotFound() | 145 | public function testApplyUserNotFound() |
146 | { | 146 | { |
147 | $repo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\UserRepository') | 147 | $repo = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository') |
148 | ->disableOriginalConstructor() | 148 | ->disableOriginalConstructor() |
149 | ->getMock(); | 149 | ->getMock(); |
150 | 150 | ||
@@ -159,7 +159,7 @@ class UsernameRssTokenConverterTest extends KernelTestCase | |||
159 | 159 | ||
160 | $em->expects($this->once()) | 160 | $em->expects($this->once()) |
161 | ->method('getRepository') | 161 | ->method('getRepository') |
162 | ->with('WallabagCoreBundle:User') | 162 | ->with('WallabagUserBundle:User') |
163 | ->will($this->returnValue($repo)); | 163 | ->will($this->returnValue($repo)); |
164 | 164 | ||
165 | $registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry') | 165 | $registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry') |
@@ -168,10 +168,10 @@ class UsernameRssTokenConverterTest extends KernelTestCase | |||
168 | 168 | ||
169 | $registry->expects($this->once()) | 169 | $registry->expects($this->once()) |
170 | ->method('getManagerForClass') | 170 | ->method('getManagerForClass') |
171 | ->with('WallabagCoreBundle:User') | 171 | ->with('WallabagUserBundle:User') |
172 | ->will($this->returnValue($em)); | 172 | ->will($this->returnValue($em)); |
173 | 173 | ||
174 | $params = new ParamConverter(array('class' => 'WallabagCoreBundle:User')); | 174 | $params = new ParamConverter(array('class' => 'WallabagUserBundle:User')); |
175 | $converter = new UsernameRssTokenConverter($registry); | 175 | $converter = new UsernameRssTokenConverter($registry); |
176 | $request = new Request(array(), array(), array('username' => 'test', 'token' => 'test')); | 176 | $request = new Request(array(), array(), array('username' => 'test', 'token' => 'test')); |
177 | 177 | ||
@@ -182,7 +182,7 @@ class UsernameRssTokenConverterTest extends KernelTestCase | |||
182 | { | 182 | { |
183 | $user = new User(); | 183 | $user = new User(); |
184 | 184 | ||
185 | $repo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\UserRepository') | 185 | $repo = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository') |
186 | ->disableOriginalConstructor() | 186 | ->disableOriginalConstructor() |
187 | ->getMock(); | 187 | ->getMock(); |
188 | 188 | ||
@@ -197,7 +197,7 @@ class UsernameRssTokenConverterTest extends KernelTestCase | |||
197 | 197 | ||
198 | $em->expects($this->once()) | 198 | $em->expects($this->once()) |
199 | ->method('getRepository') | 199 | ->method('getRepository') |
200 | ->with('WallabagCoreBundle:User') | 200 | ->with('WallabagUserBundle:User') |
201 | ->will($this->returnValue($repo)); | 201 | ->will($this->returnValue($repo)); |
202 | 202 | ||
203 | $registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry') | 203 | $registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry') |
@@ -206,10 +206,10 @@ class UsernameRssTokenConverterTest extends KernelTestCase | |||
206 | 206 | ||
207 | $registry->expects($this->once()) | 207 | $registry->expects($this->once()) |
208 | ->method('getManagerForClass') | 208 | ->method('getManagerForClass') |
209 | ->with('WallabagCoreBundle:User') | 209 | ->with('WallabagUserBundle:User') |
210 | ->will($this->returnValue($em)); | 210 | ->will($this->returnValue($em)); |
211 | 211 | ||
212 | $params = new ParamConverter(array('class' => 'WallabagCoreBundle:User', 'name' => 'user')); | 212 | $params = new ParamConverter(array('class' => 'WallabagUserBundle:User', 'name' => 'user')); |
213 | $converter = new UsernameRssTokenConverter($registry); | 213 | $converter = new UsernameRssTokenConverter($registry); |
214 | $request = new Request(array(), array(), array('username' => 'test', 'token' => 'test')); | 214 | $request = new Request(array(), array(), array('username' => 'test', 'token' => 'test')); |
215 | 215 | ||
diff --git a/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php b/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php index e5096528..756525a9 100644 --- a/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php +++ b/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php | |||
@@ -21,7 +21,7 @@ abstract class WallabagCoreTestCase extends WebTestCase | |||
21 | public function logInAs($username) | 21 | public function logInAs($username) |
22 | { | 22 | { |
23 | $crawler = $this->client->request('GET', '/login'); | 23 | $crawler = $this->client->request('GET', '/login'); |
24 | $form = $crawler->filter('button[type=submit]')->form(); | 24 | $form = $crawler->filter('input[type=submit]')->form(); |
25 | $data = array( | 25 | $data = array( |
26 | '_username' => $username, | 26 | '_username' => $username, |
27 | '_password' => 'mypassword', | 27 | '_password' => 'mypassword', |