protected function ContactEmailsTestBase::addEmailFieldToContactForm in Contact Emails 8
Helper function to add an email field to the contact form.
Throws
\Exception
2 calls to ContactEmailsTestBase::addEmailFieldToContactForm()
- ContactEmailsRecipientTest::testSendToField in src/
Tests/ ContactEmailsRecipientTest.php - Test field functionality to email address.
- ContactEmailsReplyToTest::testReplyToField in src/
Tests/ ContactEmailsReplyToTest.php - Test field functionality of reply-to email address.
File
- src/
ContactEmailsTestBase.php, line 80
Class
- ContactEmailsTestBase
- Base class for contact emails tests.
Namespace
Drupal\contact_emailsCode
protected function addEmailFieldToContactForm() {
// Add the field.
$params = [
'new_storage_type' => 'email',
'label' => 'Email address',
'field_name' => 'email_address',
];
$this
->drupalPostForm('admin/structure/contact/manage/contact_emails_test_form/fields/add-field', $params, t('Save and continue'));
// Save the default base field settings.
$this
->drupalPostForm(NULL, [], t('Save field settings'));
// Save the field settings.
$this
->drupalPostForm(NULL, [], t('Save settings'));
// Assert that the field exists.
$this
->assertText('field_email_address', 'Field email address exists.');
}