$this->
assertSession()->
elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "contact/")]'
);
// Create first valid form.
$this->
addContactForm($id =
mb_strtolower($this->
randomMachineName(16
)),
$label =
$this->
randomMachineName(16
),
implode(',',
[$recipients[0
]]), '', TRUE
);
$this->
assertSession()->
pageTextContains('Contact form ' .
$label . ' has been added.'
);
// Verify that the creation message contains a link to a contact form.
$this->
assertSession()->
elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "contact/")]'
);
// Check that the form was created in site default language.
$langcode =
$this->
config('contact.form.' .
$id)->
get('langcode'
);
$default_langcode = \Drupal::
languageManager()->
getDefaultLanguage()->
getId();
$this->
assertEquals($default_langcode,
$langcode);
// Make sure the newly created form is included in the list of forms.
$this->
assertSession()->
pageTextMatchesCount(2, '/' .
$label . '/'
);
// Ensure that the recipient email is escaped on the listing.
$this->
drupalGet('admin/structure/contact'
);
$this->
assertSession()->
assertEscaped($recipients[0
]);
// Test update contact form.
$this->
updateContactForm($id,
$label =
$this->
randomMachineName(16
),
implode(',',
[$recipients[0
],
$recipients[1
]]),
$reply =
$this->
randomMachineName(30
), FALSE, 'Your message has been sent.', '/user'
);