aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php
index e02c4d05..1dd05f89 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php
@@ -134,4 +134,49 @@ class SecurityControllerTest extends WallabagTestCase
134 ); 134 );
135 } 135 }
136 } 136 }
137
138 public function testReset()
139 {
140 $client = $this->getClient();
141 $user = $client->getContainer()
142 ->get('doctrine.orm.entity_manager')
143 ->getRepository('WallabagCoreBundle:User')
144 ->findOneByEmail('bobby@wallabag.org');
145
146 $crawler = $client->request('GET', '/forgot-password/'.$user->getConfirmationToken());
147
148 $this->assertEquals(200, $client->getResponse()->getStatusCode());
149 $this->assertCount(2, $crawler->filter('input[type=password]'));
150 $this->assertCount(1, $form = $crawler->filter('button[type=submit]'));
151 $this->assertCount(1, $form);
152
153 $data = array(
154 'change_passwd[new_password][first]' => 'mypassword',
155 'change_passwd[new_password][second]' => 'mypassword',
156 );
157
158 $client->submit($form->form(), $data);
159
160 $this->assertEquals(302, $client->getResponse()->getStatusCode());
161 $this->assertContains('login', $client->getResponse()->headers->get('location'));
162 }
163
164 public function testResetBadToken()
165 {
166 $client = $this->getClient();
167
168 $client->request('GET', '/forgot-password/UIZOAU29UE902IEPZO');
169
170 $this->assertEquals(404, $client->getResponse()->getStatusCode());
171 }
172
173 public function testCheckEmailWithoutEmail()
174 {
175 $client = $this->getClient();
176
177 $client->request('GET', '/forgot-password/check-email');
178
179 $this->assertEquals(302, $client->getResponse()->getStatusCode());
180 $this->assertContains('forgot-password', $client->getResponse()->headers->get('location'));
181 }
137} 182}