public function RealMailTest::testContact in Swift Mailer 8.2
Tests contact form messages.
File
- tests/
src/ Functional/ RealMailTest.php, line 53
Class
- RealMailTest
- Tests with real mails generated by Drupal Core.
Namespace
Drupal\Tests\swiftmailer\FunctionalCode
public function testContact() {
// Enable site-wide contact form.
$edit = [
'label' => 'Help & Support',
'id' => 'contact',
'message' => 'OK',
'recipients' => 'admin@example.com',
'reply' => '',
'selected' => TRUE,
];
$this
->drupalLogin($this
->createUser([
'administer contact forms',
'access site-wide contact form',
]));
$this
->drupalGet('admin/structure/contact/add');
$this
->submitForm($edit, 'Save');
$edit = [
'subject[0][value]' => 'Hello & greetings',
'message[0][value]' => '#I am so happy <grin>#',
];
// HTML.
$this
->drupalGet('contact/contact');
$this
->submitForm($edit, 'Send message');
$this
->assertSubject('[Help & Support] Hello & greetings');
$this
->assertBodyContains('#I am so happy <grin>#');
// Plain text.
$this
->enablePlain();
$this
->drupalGet('contact/contact');
$this
->submitForm($edit, 'Send message');
$this
->assertBodyContains('#I am so happy <grin>#');
}