You are here

public function HoneypotFormTestCase::testProtectCommentFormNormal in Honeypot 7

Test comment form protection.

File

./honeypot.test, line 107
Testing for Honeypot module.

Class

HoneypotFormTestCase
Test the functionality of the Honeypot module for forms.

Code

public function testProtectCommentFormNormal() {
  $comment = 'Test comment.';

  // Disable time limit for honeypot.
  variable_set('honeypot_time_limit', 0);

  // Log in the web user.
  $this
    ->drupalLogin($this->webUser);

  // Set up form and submit it.
  $edit['comment_body[' . LANGUAGE_NONE . '][0][value]'] = $comment;
  $this
    ->drupalPost('comment/reply/' . $this->node->nid, $edit, t('Save'));
  $this
    ->assertText(t('Your comment has been posted.'), 'Comment posted successfully.');
}