You are here

public function UserRegistrationPasswordAdminApproval::testRegistrationWithAdminApprovalEmailVerificationAndPasswordAdmin in User registration password 8

Implements testing admin approval.

File

tests/src/Functional/UserRegistrationPasswordAdminApproval.php, line 31

Class

UserRegistrationPasswordAdminApproval
Functionality tests for User registration password module.

Namespace

Drupal\Tests\user_registrationpassword\Functional

Code

public function testRegistrationWithAdminApprovalEmailVerificationAndPasswordAdmin() {
  $config = \Drupal::configFactory()
    ->getEditable('user_registrationpassword.settings');
  $user_config = \Drupal::configFactory()
    ->getEditable('user.settings');

  // Set variables like they would be set via configuration form.
  $config
    ->set('registration', UserRegistrationPassword::VERIFICATION_PASS)
    ->save();
  $user_config
    ->set('register', UserInterface::REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)
    ->set('verify_mail', 1)
    ->set('notify.register_pending_approval', 1)
    ->save();
  $this
    ->drupalGet('user/register');
  $this
    ->assertSession()
    ->responseContains('edit-pass-pass1');
}