WebformEmailProviderTest.php in Webform 8.5
File
tests/src/Functional/WebformEmailProviderTest.php
View source
<?php
namespace Drupal\Tests\webform\Functional;
class WebformEmailProviderTest extends WebformBrowserTestBase {
public function testEmailProvider() {
$this->container
->get('config.factory')
->getEditable('system.mail')
->set('interface.default', 'php_mail')
->save();
$email_provider = \Drupal::service('webform.email_provider');
$this
->drupalLogin($this->rootUser);
$this
->drupalGet('/admin/reports/status');
$this
->assertRaw('Provided by the php_mail mail plugin.');
$this
->assertNoRaw("Webform PHP mailer: Sends the message as plain text or HTML, using PHP's native mail() function.");
$this
->assertRaw('Default PHP mailer: Sends the message as plain text, using PHP\'s native mail() function.');
$email_provider
->check();
$this
->drupalGet('/admin/reports/status');
$this
->assertRaw('Provided by the Webform module.');
$this
->assertRaw("Webform PHP mailer: Sends the message as plain text or HTML, using PHP's native mail() function.");
\Drupal::service('module_installer')
->install([
'mailsystem',
]);
$this
->drupalGet('/admin/reports/status');
$this
->assertRaw('Provided by the Mail System module.');
$this
->assertNoRaw("Webform PHP mailer: Sends the message as plain text or HTML, using PHP's native mail() function.");
$this
->assertRaw('Default PHP mailer: Sends the message as plain text, using PHP\'s native mail() function.');
\Drupal::service('module_installer')
->uninstall([
'mailsystem',
]);
$this
->drupalGet('/admin/reports/status');
$this
->assertRaw("Webform PHP mailer: Sends the message as plain text or HTML, using PHP's native mail() function.");
\Drupal::service('module_installer')
->uninstall([
'mailsystem',
]);
\Drupal::service('module_installer')
->install([
'smtp',
]);
$this
->drupalGet('/admin/reports/status');
$this
->assertRaw('Provided by the Webform module.');
$this
->drupalPostForm('/admin/config/system/smtp', [
'smtp_on' => TRUE,
], 'Save configuration');
$this
->drupalGet('/admin/reports/status');
$this
->assertNoRaw('Provided by the SMTP module.');
}
}