protected function OptionsFieldUITest::createOptionsField

Helper function to create list field of a given type.

Parameters

string $type: 'list_integer', 'list_float', 'list_text' or 'list_boolean'

4 calls to OptionsFieldUITest::createOptionsField()
OptionsFieldUITest::testOptionsAllowedValuesBoolean in drupal/core/modules/field/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
Options (boolen) : test 'On/Off' values input.
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 234
Definition of Drupal\options\Tests\OptionsFieldUITest.

Class

OptionsFieldUITest
Options module UI tests.

Namespace

Drupal\options\Tests

Code

protected function createOptionsField($type) {

  // Create a test field and instance.
  $field = array(
    'field_name' => $this->field_name,
    'type' => $type,
  );
  field_create_field($field);
  $instance = array(
    'field_name' => $this->field_name,
    'entity_type' => 'node',
    'bundle' => $this->type,
  );
  field_create_instance($instance);
  $this->admin_path = 'admin/structure/types/manage/' . $this->type . '/fields/' . $this->field_name;
}