aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-10-02 01:32:23 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-10-02 11:09:28 +0200
commiteb4142e0afa5c83c9e301e38e57a72322be05e8c (patch)
tree913bdbc6ec43048ee58475c663c4d8d31086350d /tests/Wallabag
parent03141f9b9548bca117136ba5bdcf811d9e59b155 (diff)
downloadwallabag-eb4142e0afa5c83c9e301e38e57a72322be05e8c.tar.gz
wallabag-eb4142e0afa5c83c9e301e38e57a72322be05e8c.tar.zst
wallabag-eb4142e0afa5c83c9e301e38e57a72322be05e8c.zip
Remove NewUser test from Config
Diffstat (limited to 'tests/Wallabag')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php114
1 files changed, 0 insertions, 114 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
index bb3ea9e2..1954c654 100644
--- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
@@ -28,7 +28,6 @@ class ConfigControllerTest extends WallabagCoreTestCase
28 $this->assertCount(1, $crawler->filter('button[id=config_save]')); 28 $this->assertCount(1, $crawler->filter('button[id=config_save]'));
29 $this->assertCount(1, $crawler->filter('button[id=change_passwd_save]')); 29 $this->assertCount(1, $crawler->filter('button[id=change_passwd_save]'));
30 $this->assertCount(1, $crawler->filter('button[id=update_user_save]')); 30 $this->assertCount(1, $crawler->filter('button[id=update_user_save]'));
31 $this->assertCount(1, $crawler->filter('button[id=new_user_save]'));
32 $this->assertCount(1, $crawler->filter('button[id=rss_config_save]')); 31 $this->assertCount(1, $crawler->filter('button[id=rss_config_save]'));
33 } 32 }
34 33
@@ -283,119 +282,6 @@ class ConfigControllerTest extends WallabagCoreTestCase
283 $this->assertContains('flashes.config.notice.user_updated', $alert[0]); 282 $this->assertContains('flashes.config.notice.user_updated', $alert[0]);
284 } 283 }
285 284
286 public function dataForNewUserFailed()
287 {
288 return [
289 [
290 [
291 'new_user[username]' => '',
292 'new_user[plainPassword][first]' => '',
293 'new_user[plainPassword][second]' => '',
294 'new_user[email]' => '',
295 ],
296 'fos_user.username.blank',
297 ],
298 [
299 [
300 'new_user[username]' => 'a',
301 'new_user[plainPassword][first]' => 'mypassword',
302 'new_user[plainPassword][second]' => 'mypassword',
303 'new_user[email]' => '',
304 ],
305 'fos_user.username.short',
306 ],
307 [
308 [
309 'new_user[username]' => 'wallace',
310 'new_user[plainPassword][first]' => 'mypassword',
311 'new_user[plainPassword][second]' => 'mypassword',
312 'new_user[email]' => 'test',
313 ],
314 'fos_user.email.invalid',
315 ],
316 [
317 [
318 'new_user[username]' => 'admin',
319 'new_user[plainPassword][first]' => 'wallacewallace',
320 'new_user[plainPassword][second]' => 'wallacewallace',
321 'new_user[email]' => 'wallace@wallace.me',
322 ],
323 'fos_user.username.already_used',
324 ],
325 [
326 [
327 'new_user[username]' => 'wallace',
328 'new_user[plainPassword][first]' => 'mypassword1',
329 'new_user[plainPassword][second]' => 'mypassword2',
330 'new_user[email]' => 'wallace@wallace.me',
331 ],
332 'validator.password_must_match',
333 ],
334 ];
335 }
336
337 /**
338 * @dataProvider dataForNewUserFailed
339 */
340 public function testNewUserFailed($data, $expectedMessage)
341 {
342 $this->logInAs('admin');
343 $client = $this->getClient();
344
345 $crawler = $client->request('GET', '/config');
346
347 $this->assertEquals(200, $client->getResponse()->getStatusCode());
348
349 $form = $crawler->filter('button[id=new_user_save]')->form();
350
351 $crawler = $client->submit($form, $data);
352
353 $this->assertEquals(200, $client->getResponse()->getStatusCode());
354
355 $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text']));
356 $this->assertContains($expectedMessage, $alert[0]);
357 }
358
359 public function testNewUserCreated()
360 {
361 $this->logInAs('admin');
362 $client = $this->getClient();
363
364 $crawler = $client->request('GET', '/config');
365
366 $this->assertEquals(200, $client->getResponse()->getStatusCode());
367
368 $form = $crawler->filter('button[id=new_user_save]')->form();
369
370 $data = [
371 'new_user[username]' => 'wallace',
372 'new_user[plainPassword][first]' => 'wallace1',
373 'new_user[plainPassword][second]' => 'wallace1',
374 'new_user[email]' => 'wallace@wallace.me',
375 ];
376
377 $client->submit($form, $data);
378
379 $this->assertEquals(302, $client->getResponse()->getStatusCode());
380
381 $crawler = $client->followRedirect();
382
383 $this->assertContains('flashes.config.notice.user_added', $crawler->filter('body')->extract(['_text'])[0]);
384
385 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
386 $user = $em
387 ->getRepository('WallabagUserBundle:User')
388 ->findOneByUsername('wallace');
389
390 $this->assertTrue(false !== $user);
391 $this->assertTrue($user->isEnabled());
392 $this->assertEquals('material', $user->getConfig()->getTheme());
393 $this->assertEquals(12, $user->getConfig()->getItemsPerPage());
394 $this->assertEquals(50, $user->getConfig()->getRssLimit());
395 $this->assertEquals('en', $user->getConfig()->getLanguage());
396 $this->assertEquals(1, $user->getConfig()->getReadingSpeed());
397 }
398
399 public function testRssUpdateResetToken() 285 public function testRssUpdateResetToken()
400 { 286 {
401 $this->logInAs('admin'); 287 $this->logInAs('admin');