You are here

public function WebformElementCheckboxValueTest::testCheckboxValue in Webform 8.5

Same name and namespace in other branches
  1. 6.x tests/src/Functional/Element/WebformElementCheckboxValueTest.php \Drupal\Tests\webform\Functional\Element\WebformElementCheckboxValueTest::testCheckboxValue()

Tests checkbox value element.

File

tests/src/Functional/Element/WebformElementCheckboxValueTest.php, line 24

Class

WebformElementCheckboxValueTest
Tests for webform checkbox value element.

Namespace

Drupal\Tests\webform\Functional\Element

Code

public function testCheckboxValue() {
  $webform = Webform::load('test_element_checkbox_value');

  // Check submitted values.
  $this
    ->postSubmission($webform);
  $this
    ->assertRaw("checkbox_value_empty: ''\ncheckbox_value_filled: '{default_value}'\ncheckbox_value_select_other: Four");

  // Check validation.
  $edit = [
    'checkbox_value_empty[checkbox]' => TRUE,
  ];
  $this
    ->postSubmission($webform, $edit);
  $this
    ->assertRaw('Enter a value field is required.');
}