View source
<?php
namespace Drupal\Tests\reroute_email\Functional;
use Drupal\Component\Render\FormattableMarkup;
class MailKeysTest extends RerouteEmailTestBase {
public function testMailKeysFilter() {
$this
->configureRerouteEmail(TRUE, $this->rerouteDestination);
$this
->drupalGet('admin/config/development/reroute_email/test');
$this
->submitForm([
'to' => $this->originalDestination,
], t('Send email'));
$this
->assertEmailOriginallyTo();
$this
->assertMail('to', $this->rerouteDestination, new FormattableMarkup('Email was properly rerouted to the email address: @destination.', [
'@destination' => $this->rerouteDestination,
]));
$this
->configureRerouteEmail(NULL, NULL, NULL, NULL, NULL, 'not_existed_module');
$this
->drupalGet('admin/config/development/reroute_email/test');
$this
->submitForm([
'to' => $this->originalDestination,
], t('Send email'));
$this
->assertMail('to', $this->originalDestination, new FormattableMarkup('Email was properly sent the email addresses: @destination.', [
'@destination' => $this->originalDestination,
]));
$this
->configureRerouteEmail(NULL, NULL, NULL, NULL, NULL, 'reroute_email_test_email_form');
$this
->drupalGet('admin/config/development/reroute_email/test');
$this
->submitForm([
'to' => $this->originalDestination,
], t('Send email'));
$this
->assertEmailOriginallyTo();
$this
->assertMail('to', $this->rerouteDestination, new FormattableMarkup('Email was properly rerouted to the email address: @destination.', [
'@destination' => $this->rerouteDestination,
]));
$this
->configureRerouteEmail(NULL, NULL, NULL, NULL, NULL, 'reroute_email_test');
}
}