function ListFieldUITestCase::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 ListFieldUITestCase::assertAllowedValuesInput()
ListFieldUITestCase::testListAllowedValuesFloat in modules/field/modules/list/tests/list.test
List (float) : test 'allowed values' input.
ListFieldUITestCase::testListAllowedValuesInteger in modules/field/modules/list/tests/list.test
List (integer) : test 'allowed values' input.
ListFieldUITestCase::testListAllowedValuesText in modules/field/modules/list/tests/list.test
List (text) : test 'allowed values' input.

File

modules/field/modules/list/tests/list.test, line 477

Class

ListFieldUITestCase
List module UI 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);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.