You are here

public function UserRegistrationPasswordAdministrationTestCase::testRegistrationWithEmailVerificationAndPasswordAdmin in User registration password 7

Implements testRegistrationWithEmailVerificationAndPasswordAdmin().

File

tests/user_registrationpassword_admin.test, line 41
Administration tests for user_registrationpassword.module.

Class

UserRegistrationPasswordAdministrationTestCase
Class UserRegistrationPasswordAdministrationTestCase.

Code

public function testRegistrationWithEmailVerificationAndPasswordAdmin() {
  $this
    ->drupalLogin($this->admin_user);

  // Test the default options.
  $this
    ->drupalGet('admin/config/people/accounts');
  $edit = array();
  $edit['user_register'] = USER_REGISTER_VISITORS;
  $edit['user_registrationpassword_registration'] = USER_REGISTRATIONPASSWORD_VERIFICATION_PASS;
  $this
    ->drupalPost('admin/config/people/accounts', $edit, t('Save configuration'));

  // Variable user_email_verification.
  $this
    ->assertEqual(variable_get('user_email_verification', TRUE), FALSE, 'Variable user_email_verification set correctly.');

  // Variable user_mail_register_pending_approval_notify.
  $this
    ->assertEqual(variable_get('user_mail_register_pending_approval_notify', TRUE), FALSE, 'Variable user_mail_register_pending_approval_notify set correctly.');

  // Variable user_mail_register_pending_approval_notify.
  $this
    ->assertEqual(variable_get('user_mail_register_no_approval_required_notify', TRUE), FALSE, 'Variable user_mail_register_no_approval_required_notify set correctly.');

  // Test the admin approval option.
  $this
    ->drupalGet('admin/config/people/accounts');
  $edit = array();
  $edit['user_register'] = USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL;
  $edit['user_registrationpassword_registration'] = USER_REGISTRATIONPASSWORD_VERIFICATION_PASS;
  $this
    ->drupalPost('admin/config/people/accounts', $edit, t('Save configuration'));

  // Variable user_email_verification.
  $this
    ->assertEqual(variable_get('user_email_verification', FALSE), TRUE, 'Variable user_email_verification set correctly.');

  // Variable user_mail_register_pending_approval_notify.
  $this
    ->assertEqual(variable_get('user_mail_register_pending_approval_notify', FALSE), TRUE, 'Variable user_mail_register_pending_approval_notify set correctly.');

  // Variable user_mail_register_no_approval_required_notify.
  $this
    ->assertEqual(variable_get('user_mail_register_no_approval_required_notify', FALSE), TRUE, 'Variable user_mail_register_no_approval_required_notify set correctly.');

  // Test the admin only option.
  $this
    ->drupalGet('admin/config/people/accounts');
  $edit = array();
  $edit['user_register'] = USER_REGISTER_ADMINISTRATORS_ONLY;
  $edit['user_registrationpassword_registration'] = USER_REGISTRATIONPASSWORD_VERIFICATION_PASS;
  $this
    ->drupalPost('admin/config/people/accounts', $edit, t('Save configuration'));

  // Variable user_email_verification.
  $this
    ->assertEqual(variable_get('user_email_verification', FALSE), TRUE, 'Variable user_email_verification set correctly.');

  // Variable user_mail_register_pending_approval_notify.
  $this
    ->assertEqual(variable_get('user_mail_register_pending_approval_notify', TRUE), FALSE, 'Variable user_mail_register_pending_approval_notify set correctly.');

  // Variable user_mail_register_no_approval_required_notify.
  $this
    ->assertEqual(variable_get('user_mail_register_no_approval_required_notify', TRUE), FALSE, 'Variable user_mail_register_no_approval_required_notify set correctly.');
}