You are here

function OptionsFieldUITest::assertAllowedValuesInput in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/options/src/Tests/OptionsFieldUITest.php \Drupal\options\Tests\OptionsFieldUITest::assertAllowedValuesInput()

Tests a string input for the 'allowed values' form element.

Parameters

$input_string: The input string, in the pipe-linefeed format expected by the form element.

$result: Either an expected resulting array in $field->getSetting('allowed_values'), or an expected error message.

$message: Message to display.

4 calls to OptionsFieldUITest::assertAllowedValuesInput()
OptionsFieldUITest::testOptionsAllowedValuesFloat in core/modules/options/src/Tests/OptionsFieldUITest.php
Options (float) : test 'allowed values' input.
OptionsFieldUITest::testOptionsAllowedValuesInteger in core/modules/options/src/Tests/OptionsFieldUITest.php
Options (integer) : test 'allowed values' input.
OptionsFieldUITest::testOptionsAllowedValuesText in core/modules/options/src/Tests/OptionsFieldUITest.php
Options (text) : test 'allowed values' input.
OptionsFieldUITest::testOptionsTrimmedValuesText in core/modules/options/src/Tests/OptionsFieldUITest.php
Options (text) : test 'trimmed values' input.

File

core/modules/options/src/Tests/OptionsFieldUITest.php, line 298
Contains \Drupal\options\Tests\OptionsFieldUITest.

Class

OptionsFieldUITest
Tests the Options field UI functionality.

Namespace

Drupal\options\Tests

Code

function assertAllowedValuesInput($input_string, $result, $message) {
  $edit = array(
    'settings[allowed_values]' => $input_string,
  );
  $this
    ->drupalPostForm($this->adminPath, $edit, t('Save field settings'));
  $this
    ->assertNoRaw('<', 'The page does not have double escaped HTML tags.');
  if (is_string($result)) {
    $this
      ->assertText($result, $message);
  }
  else {
    $field_storage = FieldStorageConfig::loadByName('node', $this->fieldName);
    $this
      ->assertIdentical($field_storage
      ->getSetting('allowed_values'), $result, $message);
  }
}