From: Nicolas LÅ“uillet Date: Tue, 29 Sep 2015 16:11:57 +0000 (+0200) Subject: add test for confirmed registration X-Git-Tag: 2.0.0-alpha.1~28^2~8 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=2c13918acc3c46120bbef5e6746f3c6dc27be5df;p=github%2Fwallabag%2Fwallabag.git add test for confirmed registration --- diff --git a/src/Wallabag/ApiBundle/DependencyInjection/WallabagApiExtension.php b/src/Wallabag/ApiBundle/DependencyInjection/WallabagApiExtension.php index a147e7ef..cde43aed 100644 --- a/src/Wallabag/ApiBundle/DependencyInjection/WallabagApiExtension.php +++ b/src/Wallabag/ApiBundle/DependencyInjection/WallabagApiExtension.php @@ -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 { diff --git a/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php index 78b4952e..7af9d5c4 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php @@ -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();