diff options
Diffstat (limited to 'modules/user/user.test')
-rw-r--r-- | modules/user/user.test | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/modules/user/user.test b/modules/user/user.test index 67d885722..ec24035a8 100644 --- a/modules/user/user.test +++ b/modules/user/user.test @@ -9,16 +9,16 @@ class UserRegistrationTestCase extends DrupalWebTestCase { 'group' => 'User' ); } - + function testRegistrationWithEmailVerification() { // Require e-mail verification. variable_set('user_email_verification', TRUE); - + // Set registration to administrator only. variable_set('user_register', 0); $this->drupalGet('user/register'); $this->assertResponse(403, t('Registration page is inaccessible when only administrators can create accounts.')); - + // Allow registration by site visitors without administrator approval. variable_set('user_register', 1); $edit = array(); @@ -28,7 +28,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase { $this->assertText(t('Your password and further instructions have been sent to your e-mail address.'), t('User registered successfully.')); $new_user = reset(user_load_multiple(array(), array('name' => $name, 'mail' => $mail))); $this->assertTrue($new_user->status, t('New account is active after registration.')); - + // Allow registration by site visitors, but require administrator approval. variable_set('user_register', 2); $edit = array(); @@ -38,17 +38,17 @@ class UserRegistrationTestCase extends DrupalWebTestCase { $new_user = reset(user_load_multiple(array(), array('name' => $name, 'mail' => $mail))); $this->assertFalse($new_user->status, t('New account is blocked until approved by an administrator.')); } - + function testRegistrationWithoutEmailVerification() { // Don't require e-mail verification. variable_set('user_email_verification', FALSE); - + // Allow registration by site visitors without administrator approval. variable_set('user_register', 1); $edit = array(); $edit['name'] = $name = $this->randomName(); $edit['mail'] = $mail = $edit['name'] . '@example.com'; - + // Try entering a mismatching password. $edit['pass[pass1]'] = '99999.0'; $edit['pass[pass2]'] = '99999'; @@ -62,7 +62,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase { $new_user = reset(user_load_multiple(array(), array('name' => $name, 'mail' => $mail))); $this->assertText(t('Registration successful. You are now logged in.'), t('Users are logged in after registering.')); $this->drupalLogout(); - + // Allow registration by site visitors, but require administrator approval. variable_set('user_register', 2); $edit = array(); @@ -72,7 +72,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase { $edit['pass[pass2]'] = $pass; $this->drupalPost('user/register', $edit, t('Create new account')); $this->assertText(t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.'), t('Users are notified of pending approval')); - + // Try to login before administrator approval. $auth = array( 'name' => $name, @@ -90,7 +90,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase { ); $this->drupalPost('user/' . $new_user->uid . '/edit', $edit, t('Save')); $this->drupalLogout(); - + // Login after administrator approval. $this->drupalPost('user/login', $auth, t('Log in')); $this->assertText(t('Member for'), t('User can log in after administrator approval.')); @@ -99,21 +99,21 @@ class UserRegistrationTestCase extends DrupalWebTestCase { function testRegistrationDefaultValues() { // Allow registration by site visitors without administrator approval. variable_set('user_register', 1); - + // Don't require e-mail verification. variable_set('user_email_verification', FALSE); - + // Set the default timezone to Brussels. variable_set('configurable_timezones', 1); variable_set('date_default_timezone', 'Europe/Brussels'); - + $edit = array(); $edit['name'] = $name = $this->randomName(); $edit['mail'] = $mail = $edit['name'] . '@example.com'; $edit['pass[pass1]'] = $new_pass = $this->randomName(); $edit['pass[pass2]'] = $new_pass; $this->drupalPost('user/register', $edit, t('Create new account')); - + // Check user fields. $new_user = reset(user_load_multiple(array(), array('name' => $name, 'mail' => $mail))); $this->assertEqual($new_user->name, $name, t('Username matches.')); |