You are here

public function OptionsFieldUITest::testOptionsTrimmedValuesText in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/options/tests/src/Functional/OptionsFieldUITest.php \Drupal\Tests\options\Functional\OptionsFieldUITest::testOptionsTrimmedValuesText()

Options (text) : test 'trimmed values' input.

File

core/modules/options/tests/src/Functional/OptionsFieldUITest.php, line 269

Class

OptionsFieldUITest
Tests the Options field UI functionality.

Namespace

Drupal\Tests\options\Functional

Code

public function testOptionsTrimmedValuesText() {
  $this->fieldName = 'field_options_trimmed_text';
  $this
    ->createOptionsField('list_string');

  // Explicit keys.
  $string = "zero |Zero\none | One";
  $array = [
    'zero' => 'Zero',
    'one' => 'One',
  ];
  $this
    ->assertAllowedValuesInput($string, $array, 'Explicit keys are accepted and trimmed.');
}