You are here

public function HoneypotFormTestCase::testProtectRegisterUserTooFast in Honeypot 7

File

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

Class

HoneypotFormTestCase
Test the functionality of the Honeypot module for forms.

Code

public function testProtectRegisterUserTooFast() {

  // Enable time limit for honeypot.
  variable_set('honeypot_time_limit', 5);

  // Set up form and submit it.
  $edit['name'] = $this
    ->randomName();
  $edit['mail'] = $edit['name'] . '@example.com';
  $this
    ->drupalPost('user/register', $edit, t('Create new account'));

  // Form should have error message.
  $this
    ->assertText(t('There was a problem with your form submission. Please wait 6 seconds and try again.'), 'Registration form protected by time limit.');
}