You are here

protected function RangeFieldUiTest::rangeTestFieldStorageSettings in Range 8

Test range field storage settings.

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::rangeTestFieldStorageSettings()
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 67

Class

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

Namespace

Drupal\Tests\range\Functional

Code

protected function rangeTestFieldStorageSettings($field_type = 'range_integer') {
  $field_name = $this
    ->getTestFieldName($field_type);
  $settings = FieldStorageConfig::loadByName($this->entityTypeId, $field_name)
    ->getSettings();
  $test_settings = $this
    ->getTestFieldStorageSettings($field_type);
  switch ($field_type) {
    case 'range_decimal':
      $this
        ->assertEquals($settings['precision'], $test_settings['precision'], new FormattableMarkup('Correct precision setting %value found for the %field_type field type', [
        '%value' => $settings['precision'],
        '%field_type' => $field_type,
      ]));
      $this
        ->assertEquals($settings['scale'], $test_settings['scale'], new FormattableMarkup('Correct scale setting %value found for the %field_type field type', [
        '%value' => $settings['scale'],
        '%field_type' => $field_type,
      ]));
      break;
  }
}