function TransportTest::testSendmailFactoryAllowedCommand

@covers ::createTransport @covers \Drupal\Core\Mailer\Transport\SendmailCommandValidationTransportFactory::create

File

core/modules/mailer/tests/src/Kernel/TransportTest.php, line 106

Class

TransportTest
Tests the transport factory service.

Namespace

Drupal\Tests\mailer\Kernel

Code

public function testSendmailFactoryAllowedCommand() : void {
    // Test sendmail command allowlist.
    $settings = Settings::getAll();
    $settings['mailer_sendmail_commands'] = [
        '/usr/local/bin/sendmail -bs',
    ];
    new Settings($settings);
    // Test allowlisted command.
    $this->setUpMailerDsnConfigOverride('sendmail', 'default', options: [
        'command' => '/usr/local/bin/sendmail -bs',
    ]);
    $actual = $this->container
        ->get(TransportInterface::class);
    $this->assertInstanceOf(SendmailTransport::class, $actual);
}

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