function TransportTest::testSendmailFactoryUnlistedCommand
@covers ::createTransport
@covers \Drupal\Core\Mailer\Transport\SendmailCommandValidationTransportFactory::create
File
-
core/
modules/ mailer/ tests/ src/ Kernel/ TransportTest.php, line 124
Class
- TransportTest
- Tests the transport factory service.
Namespace
Drupal\Tests\mailer\KernelCode
public function testSendmailFactoryUnlistedCommand() : void {
// Test sendmail command allowlist.
$settings = Settings::getAll();
$settings['mailer_sendmail_commands'] = [
'/usr/local/bin/sendmail -bs',
];
new Settings($settings);
// Test unlisted command.
$this->setUpMailerDsnConfigOverride('sendmail', 'default', options: [
'command' => '/usr/bin/bc',
]);
$this->expectExceptionMessage('Unsafe sendmail command /usr/bin/bc');
$this->container
->get(TransportInterface::class);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.