function MailerDsnConfigValidationTest::testMailerUserPasswordValidation

Tests the validation of the password for the mailer user.

File

core/tests/Drupal/KernelTests/Core/Config/MailerDsnConfigValidationTest.php, line 164

Class

MailerDsnConfigValidationTest
Tests validation of mailer dsn config.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testMailerUserPasswordValidation() : void {
  $config = $this->config('system.mail');
  $this->assertFalse($config->isNew());
  $data = $config->get();
  // If the user is valid, it should be accepted.
  $data['mailer_dsn']['user'] = "any😎thing\ngoes";
  $violations = $this->configManager
    ->createFromNameAndData($config->getName(), $data)
    ->validate();
  $this->assertCount(0, $violations);
  // If the password is valid, it should be accepted.
  $data['mailer_dsn']['password'] = "any😎thing\ngoes";
  $violations = $this->configManager
    ->createFromNameAndData($config->getName(), $data)
    ->validate();
  $this->assertCount(0, $violations);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.