You are here

public function YamlFormElementOptionsTest::test in YAML Form 8

Tests building of options elements.

File

src/Tests/YamlFormElementOptionsTest.php, line 24

Class

YamlFormElementOptionsTest
Tests for form element options.

Namespace

Drupal\yamlform\Tests

Code

public function test() {
  global $base_path;

  /**************************************************************************/

  // Processing.

  /**************************************************************************/

  // Check default value handling.
  $this
    ->drupalPostForm('yamlform/test_element_options', [], t('Submit'));
  $this
    ->assertRaw("yamlform_options: {  }\nyamlform_options_default_value:\n  one: One\n  two: Two\n  three: Three\nyamlform_options_optgroup:\n  'Group One':\n    one: One\n  'Group Two':\n    two: Two\n  'Group Three':\n    three: Three\nyamlform_element_options_entity: yes_no\nyamlform_element_options_custom:\n  one: One\n  two: Two\n  three: Three");

  // Check default value handling.
  $this
    ->drupalPostForm('yamlform/test_element_options', [
    'yamlform_element_options_custom[options]' => 'yes_no',
  ], t('Submit'));
  $this
    ->assertRaw("yamlform_element_options_custom: yes_no");
}