protected function BulkFormTest::setUp in Contact Storage 8
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ BulkFormTest.php, line 42
Class
- BulkFormTest
- Tests a contact message bulk form.
Namespace
Drupal\Tests\contact_storage\FunctionalCode
protected function setUp() {
parent::Setup();
// Create and login administrative user.
$admin_user = $this
->drupalCreateUser([
'administer contact forms',
]);
$this
->drupalLogin($admin_user);
// Create first valid contact form.
$mail = 'simpletest@example.com';
$this
->addContactForm('test_id', 'test_label', $mail, TRUE);
$this
->assertText('Contact form test_label has been added.');
$this
->drupalLogout();
// Ensure that anonymous can submit site-wide contact form.
user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, [
'access site-wide contact form',
]);
$this
->drupalGet('contact');
$this
->assertText('Your email address');
// Submit contact form few times.
for ($i = 1; $i <= 5; $i++) {
$this
->submitContact($this
->randomMachineName(), $mail, $this
->randomMachineName(), 'test_id', $this
->randomMachineName());
$this
->assertText('Your message has been sent.');
}
}