| @@ 179-200 (lines=22) @@ | ||
| 176 | /** |
|
| 177 | * Registration fails if Terms of Serice checkbox is not set in register form |
|
| 178 | */ |
|
| 179 | public function testRegisterTosNotSet() { |
|
| 180 | $data = array( |
|
| 181 | 'User' => array( |
|
| 182 | 'username' => 'NewUser1', |
|
| 183 | 'user_email' => '[email protected]', |
|
| 184 | 'user_password' => 'NewUser1spassword', |
|
| 185 | 'password_confirm' => 'NewUser1spassword', |
|
| 186 | 'tos_confirm' => '0' |
|
| 187 | ) |
|
| 188 | ); |
|
| 189 | ||
| 190 | $Users = $this->generate('Users', |
|
| 191 | array( |
|
| 192 | 'models' => array('User' => array('register')) |
|
| 193 | )); |
|
| 194 | $Users->User->expects($this->never()) |
|
| 195 | ->method('register'); |
|
| 196 | ||
| 197 | $result = $this->testAction('users/register', |
|
| 198 | array('data' => $data, 'method' => 'post') |
|
| 199 | ); |
|
| 200 | } |
|
| 201 | ||
| 202 | public function testRegisterEmailFailed() { |
|
| 203 | Configure::write('Saito.Settings.tos_enabled', false); |
|
| @@ 236-258 (lines=23) @@ | ||
| 233 | /** |
|
| 234 | * No TOS flag is send, but it's also not necessary |
|
| 235 | */ |
|
| 236 | public function testRegisterTosNotNecessary() { |
|
| 237 | Configure::write('Saito.Settings.tos_enabled', false); |
|
| 238 | ||
| 239 | $data = array( |
|
| 240 | 'User' => array( |
|
| 241 | 'username' => 'NewUser1', |
|
| 242 | 'user_email' => '[email protected]', |
|
| 243 | 'user_password' => 'NewUser1spassword', |
|
| 244 | 'password_confirm' => 'NewUser1spassword', |
|
| 245 | ) |
|
| 246 | ); |
|
| 247 | ||
| 248 | $Users = $this->generate('Users', |
|
| 249 | array( |
|
| 250 | 'models' => array('User' => array('register')) |
|
| 251 | )); |
|
| 252 | $Users->User->expects($this->once()) |
|
| 253 | ->method('register'); |
|
| 254 | ||
| 255 | $result = $this->testAction('users/register', |
|
| 256 | array('data' => $data, 'method' => 'post') |
|
| 257 | ); |
|
| 258 | } |
|
| 259 | ||
| 260 | public function testRegisterViewForm() { |
|
| 261 | $results = $this->testAction('/users/register', |
|