function 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['settings']['allowed_values'], or an expected error message.

$message: Message to display.

3 calls to OptionsFieldUITest::assertAllowedValuesInput()
OptionsFieldUITest::testOptionsAllowedValuesFloat in drupal/core/modules/field/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
Options (float) : test 'allowed values' input.
OptionsFieldUITest::testOptionsAllowedValuesInteger in drupal/core/modules/field/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
Options (integer) : test 'allowed values' input.
OptionsFieldUITest::testOptionsAllowedValuesText in drupal/core/modules/field/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
Options (text) : test 'allowed values' input.

File

drupal/core/modules/field/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php, line 263
Definition of Drupal\options\Tests\OptionsFieldUITest.

Class

OptionsFieldUITest
Options module UI tests.

Namespace

Drupal\options\Tests

Code

function assertAllowedValuesInput($input_string, $result, $message) {
  $edit = array(
    'field[settings][allowed_values]' => $input_string,
  );
  $this
    ->drupalPost($this->admin_path, $edit, t('Save settings'));
  if (is_string($result)) {
    $this
      ->assertText($result, $message);
  }
  else {
    field_info_cache_clear();
    $field = field_info_field($this->field_name);
    $this
      ->assertIdentical($field['settings']['allowed_values'], $result, $message);
  }
}