You are here

protected function RangeTestTrait::getFieldSettings in Range 8

Returns test range field settings.

Parameters

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

Return value

array Range field settings.

3 calls to RangeTestTrait::getFieldSettings()
RangeTestTrait::createField in tests/src/Traits/RangeTestTrait.php
Creates a range field of a given type.
WidgetTest::constructRangeFieldXpath in tests/src/Kernel/Widget/WidgetTest.php
Helper: Constructs an XPath for the given range field name.
WidgetTest::testFieldWidget in tests/src/Kernel/Widget/WidgetTest.php
Tests widget.

File

tests/src/Traits/RangeTestTrait.php, line 117

Class

RangeTestTrait
Provides helper methods to test range fields.

Namespace

Drupal\Tests\range\Traits

Code

protected function getFieldSettings($field_type = 'range_integer') {
  switch ($field_type) {
    case 'range_integer':
    case 'range_float':
    case 'range_decimal':
      return [
        'min' => 0,
        'max' => 100000,
        'field' => [
          'prefix' => 'field_prefix',
          'suffix' => 'field_suffix',
        ],
        'from' => [
          'prefix' => 'from_prefix',
          'suffix' => 'from_suffix',
        ],
        'to' => [
          'prefix' => 'to_prefix',
          'suffix' => 'to_suffix',
        ],
        'combined' => [
          'prefix' => 'combined_prefix',
          'suffix' => 'combined_suffix',
        ],
      ];
  }
}