You are here

public function HoneypotFormProgrammaticSubmissionTest::testProgrammaticFormSubmission in Honeypot 2.0.x

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

Trigger a programmatic form submission and verify the validation errors.

File

tests/src/Functional/HoneypotFormProgrammaticSubmissionTest.php, line 49

Class

HoneypotFormProgrammaticSubmissionTest
Test programmatic submission of forms protected by Honeypot.

Namespace

Drupal\Tests\honeypot\Functional

Code

public function testProgrammaticFormSubmission() {
  $result = $this
    ->drupalGet('/honeypot_test/submit_form');
  $form_errors = (array) Json::decode($result);
  $this
    ->assertSession()
    ->responseNotContains('There was a problem with your form submission. Please wait 6 seconds and try again.');
  $this
    ->assertEmpty($form_errors, 'The were no validation errors when submitting the form.');
}