You are here

public function HoneypotFormTest::testProtectUserRegisterHoneypotFilled in Honeypot 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/HoneypotFormTest.php \Drupal\Tests\honeypot\Functional\HoneypotFormTest::testProtectUserRegisterHoneypotFilled()

Test for user register honeypot filled.

File

tests/src/Functional/HoneypotFormTest.php, line 138

Class

HoneypotFormTest
Test Honeypot spam protection functionality.

Namespace

Drupal\Tests\honeypot\Functional

Code

public function testProtectUserRegisterHoneypotFilled() {

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

  // Form should have error message.
  $this
    ->assertSession()
    ->pageTextContains('There was a problem with your form submission. Please refresh the page and try again.');
}