You are here

public function PurgerConfigFormTest::testFormValidation in Purge 8.3

Test validating the data.

File

tests/modules/purge_purger_test/tests/src/Functional/PurgerConfigFormTest.php, line 48

Class

PurgerConfigFormTest
Tests \Drupal\purge_purger_test\Form\PurgerConfigForm.

Namespace

Drupal\Tests\purge_purger_test\Functional

Code

public function testFormValidation() : void {

  // Assert that no validation errors occur in the testing form.
  $form_state = $this
    ->getFormStateInstance();
  $form_state
    ->addBuildInfo('args', $this->formArgs);
  $form_state
    ->setValues([
    'textfield' => "The moose in the noose ate the goose who was loose.",
  ]);
  $form = $this
    ->getFormInstance();
  $this
    ->formBuilder()
    ->submitForm($form, $form_state);
  $errors = $form_state
    ->getErrors();
  $this
    ->assertEquals(0, count($errors));
}