function MailerDsnConfigValidationTest::testMailerUserPasswordValidation

File

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

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.