소스 검색

Mise a jour des tests pour le token d'iscription.

bastien 13 년 전
부모
커밋
ecf7ab83e3
2개의 변경된 파일33개의 추가작업 그리고 10개의 파일을 삭제
  1. 25 5
      src/Muzich/CoreBundle/Tests/Controller/IndexControllerTest.php
  2. 8 5
      src/Muzich/CoreBundle/lib/FunctionalTest.php

+ 25 - 5
src/Muzich/CoreBundle/Tests/Controller/IndexControllerTest.php 파일 보기

3
 namespace Muzich\CoreBundle\Tests\Controller;
3
 namespace Muzich\CoreBundle\Tests\Controller;
4
 
4
 
5
 use Muzich\CoreBundle\lib\FunctionalTest;
5
 use Muzich\CoreBundle\lib\FunctionalTest;
6
+use Muzich\CoreBundle\Entity\RegistrationToken;
6
 
7
 
7
 class IndexControllerTest extends FunctionalTest
8
 class IndexControllerTest extends FunctionalTest
8
 {
9
 {
77
 
78
 
78
     $this->assertEquals('anon.', $this->getUser());
79
     $this->assertEquals('anon.', $this->getUser());
79
     
80
     
81
+    // On a besoin d'un token pour le moment
82
+    $token = new RegistrationToken();
83
+    $token->setToken('4vcsdv54svqcc3q1v54sdv6qs');
84
+    $em = $this->getDoctrine()->getEntityManager();
85
+    $em->persist($token);
86
+    $em->flush();
87
+    
80
     $this->exist('div.register');
88
     $this->exist('div.register');
81
     $this->exist('form[action="'.($url = $this->generateUrl('register')).'"]');
89
     $this->exist('form[action="'.($url = $this->generateUrl('register')).'"]');
82
     $this->exist('form[action="'.$url.'"] input[id="fos_user_registration_form_username"]');
90
     $this->exist('form[action="'.$url.'"] input[id="fos_user_registration_form_username"]');
89
       'raoula', 
97
       'raoula', 
90
       'raoula.def4v65sds@gmail.com', 
98
       'raoula.def4v65sds@gmail.com', 
91
       'toor', 
99
       'toor', 
92
-      'toor'
100
+      'toor',
101
+      '4vcsdv54svqcc3q1v54sdv6qs'
93
     );
102
     );
94
   }
103
   }
95
   
104
   
101
      */
110
      */
102
     $this->client = self::createClient();
111
     $this->client = self::createClient();
103
 
112
 
113
+    // On a besoin d'un token pour le moment
114
+    $token = new RegistrationToken();
115
+    $token->setToken('45gf645jgf6xqz4dc');
116
+    $em = $this->getDoctrine()->getEntityManager();
117
+    $em->persist($token);
118
+    $em->flush();
119
+    
104
     // Mots de passe différents
120
     // Mots de passe différents
105
     $this->procedure_registration_failure(
121
     $this->procedure_registration_failure(
106
       'raoulb', 
122
       'raoulb', 
107
       'raoulb.def4v65sds@gmail.com', 
123
       'raoulb.def4v65sds@gmail.com', 
108
       'toor', 
124
       'toor', 
109
-      'toorr'
125
+      'toorr',
126
+      '45gf645jgf6xqz4dc'
110
     );
127
     );
111
 
128
 
112
     // Pseudo trop court
129
     // Pseudo trop court
114
       'ra', 
131
       'ra', 
115
       'raoulb.def4v65sds@gmail.com', 
132
       'raoulb.def4v65sds@gmail.com', 
116
       'toor', 
133
       'toor', 
117
-      'toor'
134
+      'toor',
135
+      '45gf645jgf6xqz4dc'
118
     );
136
     );
119
     
137
     
120
     // Pseudo trop long
138
     // Pseudo trop long
124
          .'uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuul', 
142
          .'uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuul', 
125
       'raoulb.def4v65sds@gmail.com', 
143
       'raoulb.def4v65sds@gmail.com', 
126
       'toor', 
144
       'toor', 
127
-      'toor'
145
+      'toor',
146
+      '45gf645jgf6xqz4dc'
128
     );
147
     );
129
 
148
 
130
     // Email invalide
149
     // Email invalide
132
       'raoulc', 
151
       'raoulc', 
133
       'raoulb.def4v65sds@gmail', 
152
       'raoulb.def4v65sds@gmail', 
134
       'toor', 
153
       'toor', 
135
-      'toor'
154
+      'toor',
155
+      '45gf645jgf6xqz4dc'
136
     );
156
     );
137
   }
157
   }
138
   
158
   

+ 8 - 5
src/Muzich/CoreBundle/lib/FunctionalTest.php 파일 보기

77
     $this->crawler = $this->client->request('GET', $this->generateUrl('fos_user_security_logout'));
77
     $this->crawler = $this->client->request('GET', $this->generateUrl('fos_user_security_logout'));
78
   }
78
   }
79
   
79
   
80
-  protected function validate_registrate_user_form($form, $username, $email, $pass1, $pass2)
80
+  protected function validate_registrate_user_form($form, $username, $email, $pass1, $pass2, $token)
81
   {
81
   {
82
     $form['fos_user_registration_form[username]'] = $username;
82
     $form['fos_user_registration_form[username]'] = $username;
83
     $form['fos_user_registration_form[email]'] = $email;
83
     $form['fos_user_registration_form[email]'] = $email;
84
     $form['fos_user_registration_form[plainPassword][first]'] = $pass1;
84
     $form['fos_user_registration_form[plainPassword][first]'] = $pass1;
85
     // Un des mots de passe est incorrect
85
     // Un des mots de passe est incorrect
86
     $form['fos_user_registration_form[plainPassword][second]'] = $pass2;
86
     $form['fos_user_registration_form[plainPassword][second]'] = $pass2;
87
+    $form['fos_user_registration_form[token]'] = $token;
87
     $this->submit($form);
88
     $this->submit($form);
88
   }
89
   }
89
   
90
   
90
-  protected function procedure_registration_success($username, $email, $pass1, $pass2)
91
+  protected function procedure_registration_success($username, $email, $pass1, $pass2, $token)
91
   {
92
   {
92
     $this->crawler = $this->client->request('GET', $this->generateUrl('index'));
93
     $this->crawler = $this->client->request('GET', $this->generateUrl('index'));
93
     $this->isResponseSuccess();
94
     $this->isResponseSuccess();
100
       $username, 
101
       $username, 
101
       $email, 
102
       $email, 
102
       $pass1,
103
       $pass1,
103
-      $pass2
104
+      $pass2,
105
+      $token
104
     );
106
     );
105
     
107
     
106
     
108
     
127
     }
129
     }
128
   }
130
   }
129
   
131
   
130
-  protected function procedure_registration_failure($username, $email, $pass1, $pass2)
132
+  protected function procedure_registration_failure($username, $email, $pass1, $pass2, $token)
131
   {
133
   {
132
     $this->crawler = $this->client->request('GET', $this->generateUrl('index'));
134
     $this->crawler = $this->client->request('GET', $this->generateUrl('index'));
133
     $this->isResponseSuccess();
135
     $this->isResponseSuccess();
140
       $username, 
142
       $username, 
141
       $email, 
143
       $email, 
142
       $pass1,
144
       $pass1,
143
-      $pass2
145
+      $pass2,
146
+      $token
144
     );
147
     );
145
     
148
     
146
     $this->isResponseSuccess();
149
     $this->isResponseSuccess();