diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-08-25 16:29:22 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-09-11 20:32:37 +0200 |
commit | 3f7a62908cc34b9d575bea5629dc0bb94e521e71 (patch) | |
tree | 0e1f987dde2e4b96050fc0c44b2fd2782843723a /src | |
parent | a1691859ca0cb4c1b360c34b05aa74bdba9e582a (diff) | |
download | wallabag-3f7a62908cc34b9d575bea5629dc0bb94e521e71.tar.gz wallabag-3f7a62908cc34b9d575bea5629dc0bb94e521e71.tar.zst wallabag-3f7a62908cc34b9d575bea5629dc0bb94e521e71.zip |
fix tests for FosUser
Diffstat (limited to 'src')
3 files changed, 16 insertions, 17 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 62ef3eea..73484d86 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -65,7 +65,7 @@ class ConfigController extends Controller | |||
65 | } | 65 | } |
66 | 66 | ||
67 | // handle changing user information | 67 | // handle changing user information |
68 | $userForm = $this->createForm(new UserInformationType(), $user); | 68 | $userForm = $this->createForm(new UserInformationType(), $user, array('validation_groups' => array('Profile'))); |
69 | $userForm->handleRequest($request); | 69 | $userForm->handleRequest($request); |
70 | 70 | ||
71 | if ($userForm->isValid()) { | 71 | if ($userForm->isValid()) { |
@@ -98,7 +98,7 @@ class ConfigController extends Controller | |||
98 | 98 | ||
99 | // handle adding new user | 99 | // handle adding new user |
100 | $newUser = new User(); | 100 | $newUser = new User(); |
101 | $newUserForm = $this->createForm(new NewUserType(), $newUser); | 101 | $newUserForm = $this->createForm(new NewUserType(), $newUser, array('validation_groups' => array('Profile'))); |
102 | $newUserForm->handleRequest($request); | 102 | $newUserForm->handleRequest($request); |
103 | 103 | ||
104 | if ($newUserForm->isValid()) { | 104 | if ($newUserForm->isValid()) { |
diff --git a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php index 1b628051..e3196d9c 100644 --- a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php +++ b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php | |||
@@ -14,9 +14,16 @@ class UserInformationType extends AbstractType | |||
14 | ->add('name', 'text') | 14 | ->add('name', 'text') |
15 | ->add('email', 'email') | 15 | ->add('email', 'email') |
16 | ->add('save', 'submit') | 16 | ->add('save', 'submit') |
17 | ->remove('username') | ||
18 | ->remove('plainPassword') | ||
17 | ; | 19 | ; |
18 | } | 20 | } |
19 | 21 | ||
22 | public function getParent() | ||
23 | { | ||
24 | return 'fos_user_registration'; | ||
25 | } | ||
26 | |||
20 | public function configureOptions(OptionsResolver $resolver) | 27 | public function configureOptions(OptionsResolver $resolver) |
21 | { | 28 | { |
22 | $resolver->setDefaults(array( | 29 | $resolver->setDefaults(array( |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php index e11da935..116eec60 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php | |||
@@ -192,14 +192,14 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
192 | 'update_user[name]' => '', | 192 | 'update_user[name]' => '', |
193 | 'update_user[email]' => '', | 193 | 'update_user[email]' => '', |
194 | ), | 194 | ), |
195 | 'This value should not be blank.', | 195 | 'Please enter an email', |
196 | ), | 196 | ), |
197 | array( | 197 | array( |
198 | array( | 198 | array( |
199 | 'update_user[name]' => '', | 199 | 'update_user[name]' => '', |
200 | 'update_user[email]' => 'test', | 200 | 'update_user[email]' => 'test', |
201 | ), | 201 | ), |
202 | 'This value is not a valid email address.', | 202 | 'The email is not valid', |
203 | ), | 203 | ), |
204 | ); | 204 | ); |
205 | } | 205 | } |
@@ -261,15 +261,15 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
261 | 'new_user[password]' => '', | 261 | 'new_user[password]' => '', |
262 | 'new_user[email]' => '', | 262 | 'new_user[email]' => '', |
263 | ), | 263 | ), |
264 | 'This value should not be blank.', | 264 | 'Please enter a username', |
265 | ), | 265 | ), |
266 | array( | 266 | array( |
267 | array( | 267 | array( |
268 | 'new_user[username]' => 'ad', | 268 | 'new_user[username]' => 'a', |
269 | 'new_user[password]' => 'mypassword', | 269 | 'new_user[password]' => 'mypassword', |
270 | 'new_user[email]' => '', | 270 | 'new_user[email]' => '', |
271 | ), | 271 | ), |
272 | 'This value is too short.', | 272 | 'The username is too short', |
273 | ), | 273 | ), |
274 | array( | 274 | array( |
275 | array( | 275 | array( |
@@ -277,15 +277,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
277 | 'new_user[password]' => 'mypassword', | 277 | 'new_user[password]' => 'mypassword', |
278 | 'new_user[email]' => 'test', | 278 | 'new_user[email]' => 'test', |
279 | ), | 279 | ), |
280 | 'This value is not a valid email address.', | 280 | 'The email is not valid', |
281 | ), | ||
282 | array( | ||
283 | array( | ||
284 | 'new_user[username]' => 'wallace', | ||
285 | 'new_user[password]' => 'admin', | ||
286 | 'new_user[email]' => 'wallace@wallace.me', | ||
287 | ), | ||
288 | 'Password should by at least', | ||
289 | ), | 281 | ), |
290 | array( | 282 | array( |
291 | array( | 283 | array( |
@@ -293,7 +285,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
293 | 'new_user[password]' => 'wallacewallace', | 285 | 'new_user[password]' => 'wallacewallace', |
294 | 'new_user[email]' => 'wallace@wallace.me', | 286 | 'new_user[email]' => 'wallace@wallace.me', |
295 | ), | 287 | ), |
296 | 'This value is already used', | 288 | 'The username is already used', |
297 | ), | 289 | ), |
298 | ); | 290 | ); |
299 | } | 291 | } |