diff options
author | Jeremy <jeremy.benoist@gmail.com> | 2015-03-08 22:47:32 +0100 |
---|---|---|
committer | Jeremy <jeremy.benoist@gmail.com> | 2015-03-08 22:47:32 +0100 |
commit | d0c2243b1099303be961c9d4b33eaaa95e663bef (patch) | |
tree | 4c81979adefda73fea12bada41c3e40caef285eb /src/Wallabag/CoreBundle/Tests | |
parent | 6894d48e03c397096bb64420373afa60c397fe97 (diff) | |
download | wallabag-d0c2243b1099303be961c9d4b33eaaa95e663bef.tar.gz wallabag-d0c2243b1099303be961c9d4b33eaaa95e663bef.tar.zst wallabag-d0c2243b1099303be961c9d4b33eaaa95e663bef.zip |
Add some tests
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests')
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php | 45 |
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 | } |