You are here

protected function RangeFieldUiTest::rangeTestAddNewField in Range 8

Test creating range field via field UI.

Parameters

string $field_type: Range field type. Could be one of the following values: range_integer, range_float or range_decimal.

1 call to RangeFieldUiTest::rangeTestAddNewField()
RangeFieldUiTest::testRangeFieldsUi in tests/src/Functional/RangeFieldUiTest.php
Tests adding range fields and their settings via field UI.

File

tests/src/Functional/RangeFieldUiTest.php, line 47

Class

RangeFieldUiTest
Tests adding range fields and their settings via field UI.

Namespace

Drupal\Tests\range\Functional

Code

protected function rangeTestAddNewField($field_type = 'range_integer') {
  $bundle_path = "admin/structure/types/manage/{$this->bundle}";
  $field_name = $this
    ->getTestFieldNameRaw($field_type);
  $label = $this
    ->randomMachineName();
  $storage_edit = $this
    ->getStorageEdit($field_type);
  $field_edit = $this
    ->getFieldEdit($field_type);
  $this
    ->fieldUIAddNewField($bundle_path, $field_name, $label, $field_type, $storage_edit, $field_edit);

  // Clears all caches related to field definitions.
  \Drupal::service('entity_field.manager')
    ->clearCachedFieldDefinitions();
}