public function HoneypotFormTest::testProtectCommentFormNormal in Honeypot 8
Same name and namespace in other branches
- 2.0.x tests/src/Functional/HoneypotFormTest.php \Drupal\Tests\honeypot\Functional\HoneypotFormTest::testProtectCommentFormNormal()
Test comment form protection.
File
- tests/
src/ Functional/ HoneypotFormTest.php, line 194
Class
- HoneypotFormTest
- Test Honeypot spam protection functionality.
Namespace
Drupal\Tests\honeypot\FunctionalCode
public function testProtectCommentFormNormal() {
$comment = 'Test comment.';
// Disable time limit for honeypot.
\Drupal::configFactory()
->getEditable('honeypot.settings')
->set('time_limit', 0)
->save();
// Log in the web user.
$this
->drupalLogin($this->webUser);
// Set up form and submit it.
$edit["comment_body[0][value]"] = $comment;
$this
->drupalPostForm('comment/reply/node/' . $this->node
->id() . '/comment', $edit, $this
->t('Save'));
$this
->assertSession()
->pageTextContains('Your comment has been queued for review');
}