]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
fix tests for FosUser
authorNicolas Lœuillet <nicolas@loeuillet.org>
Tue, 25 Aug 2015 14:29:22 +0000 (16:29 +0200)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Fri, 11 Sep 2015 18:32:37 +0000 (20:32 +0200)
src/Wallabag/CoreBundle/Controller/ConfigController.php
src/Wallabag/CoreBundle/Form/Type/UserInformationType.php
src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php

index 62ef3eeaf4107741be3671164131a8fb785b878e..73484d86c2f0949a01649a6954cd8985e1893677 100644 (file)
@@ -65,7 +65,7 @@ class ConfigController extends Controller
         }
 
         // handle changing user information
-        $userForm = $this->createForm(new UserInformationType(), $user);
+        $userForm = $this->createForm(new UserInformationType(), $user, array('validation_groups' => array('Profile')));
         $userForm->handleRequest($request);
 
         if ($userForm->isValid()) {
@@ -98,7 +98,7 @@ class ConfigController extends Controller
 
         // handle adding new user
         $newUser = new User();
-        $newUserForm = $this->createForm(new NewUserType(), $newUser);
+        $newUserForm = $this->createForm(new NewUserType(), $newUser, array('validation_groups' => array('Profile')));
         $newUserForm->handleRequest($request);
 
         if ($newUserForm->isValid()) {
index 1b62805113deaa3fe8a4fc6d0579bf297c9d5303..e3196d9cc868def3cd4f633f705b1182e8041e05 100644 (file)
@@ -14,9 +14,16 @@ class UserInformationType extends AbstractType
             ->add('name', 'text')
             ->add('email', 'email')
             ->add('save', 'submit')
+            ->remove('username')
+            ->remove('plainPassword')
         ;
     }
 
+    public function getParent()
+    {
+        return 'fos_user_registration';
+    }
+
     public function configureOptions(OptionsResolver $resolver)
     {
         $resolver->setDefaults(array(
index e11da935290401c5efcaff01407eec4ad67b00be..116eec602f241c9f67aaf5fb06b945924fde5277 100644 (file)
@@ -192,14 +192,14 @@ class ConfigControllerTest extends WallabagCoreTestCase
                     'update_user[name]' => '',
                     'update_user[email]' => '',
                 ),
-                'This value should not be blank.',
+                'Please enter an email',
             ),
             array(
                 array(
                     'update_user[name]' => '',
                     'update_user[email]' => 'test',
                 ),
-                'This value is not a valid email address.',
+                'The email is not valid',
             ),
         );
     }
@@ -261,15 +261,15 @@ class ConfigControllerTest extends WallabagCoreTestCase
                     'new_user[password]' => '',
                     'new_user[email]' => '',
                 ),
-                'This value should not be blank.',
+                'Please enter a username',
             ),
             array(
                 array(
-                    'new_user[username]' => 'ad',
+                    'new_user[username]' => 'a',
                     'new_user[password]' => 'mypassword',
                     'new_user[email]' => '',
                 ),
-                'This value is too short.',
+                'The username is too short',
             ),
             array(
                 array(
@@ -277,15 +277,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
                     'new_user[password]' => 'mypassword',
                     'new_user[email]' => 'test',
                 ),
-                'This value is not a valid email address.',
-            ),
-            array(
-                array(
-                    'new_user[username]' => 'wallace',
-                    'new_user[password]' => 'admin',
-                    'new_user[email]' => 'wallace@wallace.me',
-                ),
-                'Password should by at least',
+                'The email is not valid',
             ),
             array(
                 array(
@@ -293,7 +285,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
                     'new_user[password]' => 'wallacewallace',
                     'new_user[email]' => 'wallace@wallace.me',
                 ),
-                'This value is already used',
+                'The username is already used',
             ),
         );
     }