You are here

public function HoneypotFormTest::testProtectRegisterUserNormal in Honeypot 2.0.x

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

Test user registration (anonymous users).

File

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

Class

HoneypotFormTest
Test Honeypot spam protection functionality.

Namespace

Drupal\Tests\honeypot\Functional

Code

public function testProtectRegisterUserNormal() {

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

  // Form should have been submitted successfully.
  $this
    ->assertSession()
    ->pageTextContains('A welcome message with further instructions has been sent to your email address.');
}