public function ContactStorageTest::testMaximumSubmissionLimit in Contact Storage 8
File
- tests/src/Functional/ContactStorageTest.php, line 392
Class
- ContactStorageTest
- Tests storing contact messages and viewing them through UI.
Namespace
Drupal\Tests\contact_storage\Functional
Code
public function testMaximumSubmissionLimit() {
$this
->addContactForm('test_id_3', 'test_label', 'simpletest@example.com', FALSE, [
'contact_storage_maximum_submissions_user' => 2,
]);
$this
->assertText('Contact form test_label has been added.');
$this
->drupalGet('contact/test_id_3');
$edit = [
'subject[0][value]' => 'Test subject',
'message[0][value]' => 'Test message',
'copy' => 'checked',
];
$this
->drupalPostForm(NULL, $edit, t('Send message'));
$this
->assertText('Your message has been sent.');
$this
->drupalGet('contact/test_id_3');
$this
->drupalPostForm(NULL, $edit, t('Send message'));
$this
->assertText('Your message has been sent.');
$this
->drupalGet('contact/test_id_3');
$this
->assertText('You have reached the maximum submission limit of 2 for this form.');
}