]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
add test for confirmed registration
authorNicolas LÅ“uillet <nicolas@loeuillet.org>
Tue, 29 Sep 2015 16:11:57 +0000 (18:11 +0200)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Sat, 3 Oct 2015 11:30:43 +0000 (13:30 +0200)
src/Wallabag/ApiBundle/DependencyInjection/WallabagApiExtension.php
src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php

index a147e7ef7351196631ab09d8832c3d2d655f30d8..cde43aedba37484cbc4f1078002700c31e485d69 100644 (file)
@@ -3,9 +3,7 @@
 namespace Wallabag\ApiBundle\DependencyInjection;
 
 use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\Config\FileLocator;
 use Symfony\Component\HttpKernel\DependencyInjection\Extension;
-use Symfony\Component\DependencyInjection\Loader;
 
 class WallabagApiExtension extends Extension
 {
index 78b4952e4583f72638a0aecc0ea5af44f799aaf0..7af9d5c45747e7f932c4c657f0406ad6abb8e566 100644 (file)
@@ -78,7 +78,7 @@ class SecurityControllerTest extends WallabagCoreTestCase
                     'fos_user_registration_form[plainPassword][first]' => 'mypassword',
                     'fos_user_registration_form[plainPassword][second]' => 'mypassword',
                 ),
-            )
+            ),
         );
     }
 
@@ -101,6 +101,31 @@ class SecurityControllerTest extends WallabagCoreTestCase
         $this->assertContains('The user has been created successfully', $client->getResponse()->getContent());
     }
 
+    public function testRegistrationConfirmation()
+    {
+        $client = $this->getClient();
+        $client->followRedirects();
+
+        $user = $client->getContainer()
+            ->get('doctrine.orm.entity_manager')
+            ->getRepository('WallabagCoreBundle:User')
+            ->findOneByUsername('newuser');
+
+        $this->assertNull($user->getConfig());
+
+        $client->request('GET', '/register/confirm/b4dT0k3n');
+        $this->assertEquals(404, $client->getResponse()->getStatusCode());
+
+        $crawler = $client->request('GET', '/register/confirm/'.$user->getConfirmationToken());
+        $this->assertEquals(200, $client->getResponse()->getStatusCode());
+
+        $user = $client->getContainer()
+            ->get('doctrine.orm.entity_manager')
+            ->getRepository('WallabagCoreBundle:User')
+            ->findOneByUsername('newuser');
+        $this->assertNotNull($user->getConfig());
+    }
+
     public function testLogin()
     {
         $client = $this->getClient();