You are here

WebformElementCheckboxValueTest.php in Webform 8.5

Same filename and directory in other branches
  1. 6.x tests/src/Functional/Element/WebformElementCheckboxValueTest.php

File

tests/src/Functional/Element/WebformElementCheckboxValueTest.php
View source
<?php

namespace Drupal\Tests\webform\Functional\Element;

use Drupal\webform\Entity\Webform;

/**
 * Tests for webform checkbox value element.
 *
 * @group webform
 */
class WebformElementCheckboxValueTest extends WebformElementBrowserTestBase {

  /**
   * Webforms to load.
   *
   * @var array
   */
  protected static $testWebforms = [
    'test_element_checkbox_value',
  ];

  /**
   * Tests checkbox value element.
   */
  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.');
  }

}

Classes

Namesort descending Description
WebformElementCheckboxValueTest Tests for webform checkbox value element.