aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
diff options
context:
space:
mode:
authorJeremy <jeremy.benoist@gmail.com>2015-03-28 00:10:39 +0100
committerJeremy <jeremy.benoist@gmail.com>2015-04-01 21:23:27 +0200
commitc844dc0c50bb4f1044154401310af25eb21b0f11 (patch)
treea4572193af600a8170b220c0c186bc46d6dd3d8e /src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
parent1a93ee423b072ec3bcb0c437cbf9b488bdea245c (diff)
downloadwallabag-c844dc0c50bb4f1044154401310af25eb21b0f11.tar.gz
wallabag-c844dc0c50bb4f1044154401310af25eb21b0f11.tar.zst
wallabag-c844dc0c50bb4f1044154401310af25eb21b0f11.zip
Remove ability to change username
Since password are linked to username it was hard to change username while checking that the password is the good one. Instead of doing crazy things to achieve that, I act that user won't be able to update username. Also, username (and email) must be unique, since people logged in using username and can request a new password using email. This should fix #1149
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
index 11c86423..5030bcbd 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
@@ -27,7 +27,7 @@ class ConfigControllerTest extends WallabagTestCase
27 27
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=user_save]')); 30 $this->assertCount(1, $crawler->filter('button[id=update_user_save]'));
31 $this->assertCount(1, $crawler->filter('button[id=new_user_save]')); 31 $this->assertCount(1, $crawler->filter('button[id=new_user_save]'));
32 $this->assertCount(1, $crawler->filter('button[id=rss_config_save]')); 32 $this->assertCount(1, $crawler->filter('button[id=rss_config_save]'));
33 } 33 }
@@ -189,25 +189,15 @@ class ConfigControllerTest extends WallabagTestCase
189 return array( 189 return array(
190 array( 190 array(
191 array( 191 array(
192 'user[username]' => '', 192 'update_user[name]' => '',
193 'user[name]' => '', 193 'update_user[email]' => '',
194 'user[email]' => '',
195 ), 194 ),
196 'This value should not be blank.', 195 'This value should not be blank.',
197 ), 196 ),
198 array( 197 array(
199 array( 198 array(
200 'user[username]' => 'ad', 199 'update_user[name]' => '',
201 'user[name]' => '', 200 'update_user[email]' => 'test',
202 'user[email]' => '',
203 ),
204 'This value is too short.',
205 ),
206 array(
207 array(
208 'user[username]' => 'admin',
209 'user[name]' => '',
210 'user[email]' => 'test',
211 ), 201 ),
212 'This value is not a valid email address.', 202 'This value is not a valid email address.',
213 ), 203 ),
@@ -226,7 +216,7 @@ class ConfigControllerTest extends WallabagTestCase
226 216
227 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 217 $this->assertEquals(200, $client->getResponse()->getStatusCode());
228 218
229 $form = $crawler->filter('button[id=user_save]')->form(); 219 $form = $crawler->filter('button[id=update_user_save]')->form();
230 220
231 $crawler = $client->submit($form, $data); 221 $crawler = $client->submit($form, $data);
232 222
@@ -245,12 +235,11 @@ class ConfigControllerTest extends WallabagTestCase
245 235
246 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 236 $this->assertEquals(200, $client->getResponse()->getStatusCode());
247 237
248 $form = $crawler->filter('button[id=user_save]')->form(); 238 $form = $crawler->filter('button[id=update_user_save]')->form();
249 239
250 $data = array( 240 $data = array(
251 'user[username]' => 'admin', 241 'update_user[name]' => 'new name',
252 'user[name]' => 'new name', 242 'update_user[email]' => 'admin@wallabag.io',
253 'user[email]' => 'admin@wallabag.io',
254 ); 243 );
255 244
256 $client->submit($form, $data); 245 $client->submit($form, $data);
@@ -298,6 +287,14 @@ class ConfigControllerTest extends WallabagTestCase
298 ), 287 ),
299 'Password should by at least', 288 'Password should by at least',
300 ), 289 ),
290 array(
291 array(
292 'new_user[username]' => 'admin',
293 'new_user[password]' => 'wallacewallace',
294 'new_user[email]' => 'wallace@wallace.me',
295 ),
296 'This value is already used',
297 ),
301 ); 298 );
302 } 299 }
303 300