function FieldTypePluginManagerTest::testDefaultSettings

Same name in other branches
  1. 9 core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php \Drupal\Tests\field\Kernel\FieldTypePluginManagerTest::testDefaultSettings()
  2. 10 core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php \Drupal\Tests\field\Kernel\FieldTypePluginManagerTest::testDefaultSettings()
  3. 11.x core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php \Drupal\Tests\field\Kernel\FieldTypePluginManagerTest::testDefaultSettings()

Tests the default settings convenience methods.

File

core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php, line 23

Class

FieldTypePluginManagerTest
Tests the field type manager.

Namespace

Drupal\Tests\field\Kernel

Code

public function testDefaultSettings() {
    $field_type_manager = \Drupal::service('plugin.manager.field.field_type');
    foreach ([
        'test_field',
        'shape',
        'hidden_test_field',
    ] as $type) {
        $definition = $field_type_manager->getDefinition($type);
        $this->assertIdentical($field_type_manager->getDefaultStorageSettings($type), $definition['class']::defaultStorageSettings(), new FormattableMarkup("%type storage settings were returned", [
            '%type' => $type,
        ]));
        $this->assertIdentical($field_type_manager->getDefaultFieldSettings($type), $definition['class']::defaultFieldSettings(), new FormattableMarkup(" %type field settings were returned", [
            '%type' => $type,
        ]));
    }
}

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