function TransportServiceFactoryTest::testDefaultTestMailFactory

Test that the transport is set to null://null by default in the child site.

The mailer configuration is set to a safe default during test setUp by FunctionalTestSetupTrait::initConfig(). This is in order to prevent tests from accidentally sending out emails. This test ensures that the transport service is configured correctly in the test child site.

File

core/modules/mailer/tests/src/Functional/TransportServiceFactoryTest.php, line 39

Class

TransportServiceFactoryTest
Tests the transport service factory in the child site of browser tests.

Namespace

Drupal\Tests\mailer\Functional

Code

public function testDefaultTestMailFactory() : void {
  $response = $this->drupalGet('mailer-transport-factory-functional-test/transport-info');
  $actual = json_decode($response, TRUE);
  $expected = [
    'mailerDsn' => [
      'scheme' => 'null',
      'host' => 'null',
      'user' => NULL,
      'password' => NULL,
      'port' => NULL,
      'options' => [],
    ],
    'mailerTransportClass' => NullTransport::class,
  ];
  $this->assertEquals($expected, $actual);
}

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