function MailerDsnConfigValidationTest::testMailerTransportDefaultOptionsValidation

File

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

Class

MailerDsnConfigValidationTest
Tests validation of mailer dsn config.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testMailerTransportDefaultOptionsValidation() : void {
    $config = $this->config('system.mail');
    $this->assertFalse($config->isNew());
    $data = $config->get();
    // Set scheme to an unknown schema.
    $data['mailer_dsn']['scheme'] = 'drupal.unknown-scheme+https';
    // If there is no more specific type for a scheme, options with any key
    // should be accepted.
    $data['mailer_dsn']['options'] = [
        'any_bool' => TRUE,
        'any_int' => 42,
        'any_string' => "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.