function ContactPersonalTest::testPersonalContactForm
Same name in other branches
- 11.x core/modules/contact/tests/src/Functional/ContactPersonalTest.php \Drupal\Tests\contact\Functional\ContactPersonalTest::testPersonalContactForm()
Tests that the opt-out message is included correctly in contact emails.
File
-
core/
modules/ contact/ tests/ src/ Functional/ ContactPersonalTest.php, line 362
Class
- ContactPersonalTest
- Tests personal contact form functionality.
Namespace
Drupal\Tests\contact\FunctionalCode
public function testPersonalContactForm() : void {
$opt_out_message = "If you don't want to receive such messages, you can change your settings at";
// Send an email from an admin (should not contain the opt-out message).
$this->drupalLogin($this->adminUser);
$this->submitPersonalContact($this->contactUser);
$this->drupalLogout();
$this->assertStringNotContainsString($opt_out_message, $this->getMails()[0]['body'], 'Opt-out message excluded in email.');
// Send an email from a non-admin (should contain the opt-out message).
$this->drupalLogin($this->webUser);
$this->submitPersonalContact($this->contactUser);
$this->assertMailString('body', $opt_out_message, 1, 'Opt-out message included in email.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.