You are here

public function WebformOptionsEntityTest::testWebformOptionsMethods in Webform 8.5

Same name and namespace in other branches
  1. 6.x tests/src/Kernel/Entity/WebformOptionsEntityTest.php \Drupal\Tests\webform\Kernel\Entity\WebformOptionsEntityTest::testWebformOptionsMethods()

Tests some of the methods.

File

tests/src/Kernel/Entity/WebformOptionsEntityTest.php, line 27

Class

WebformOptionsEntityTest
Tests the webform options entity class.

Namespace

Drupal\Tests\webform\Kernel\Entity

Code

public function testWebformOptionsMethods() {

  // Create webform options.
  $values = [
    'id' => 'webform_options_test',
  ];

  /** @var \Drupal\webform\WebformOptionsInterface $webform_options */
  $webform_options = WebformOptions::create($values);
  $this
    ->assertEquals('webform_options_test', $webform_options
    ->id());

  // Check get options.
  $options = [
    'one' => 'One',
    'two' => 'Two',
    'Three' => 'Three',
  ];
  $webform_options
    ->set('options', Yaml::encode($options));
  $this
    ->assertEquals($webform_options
    ->getOptions(), $options);

  // @todo Add the below assertions.
  // Check get invalid options.
  // Check options alter hook.
  // Check customizing dynamic options.
  // Check get element's #options.
}