You are here

public function WebformFormValidateTest::testValidate in Webform 8.5

Same name and namespace in other branches
  1. 6.x tests/src/Functional/Form/WebformFormValidateTest.php \Drupal\Tests\webform\Functional\Form\WebformFormValidateTest::testValidate()

Tests form (custom) validation.

File

tests/src/Functional/Form/WebformFormValidateTest.php, line 32

Class

WebformFormValidateTest
Tests for webform form validation.

Namespace

Drupal\Tests\webform\Functional\Form

Code

public function testValidate() {

  /* Test form#validate webform handling */
  $webform_validate = Webform::load('test_form_validate');
  $this
    ->postSubmission($webform_validate, []);
  $this
    ->assertRaw('Custom element is required.');
  $this
    ->postSubmission($webform_validate, [
    'custom' => 'value',
  ]);
  $this
    ->assertNoRaw('Custom element is required.');
}