function ManageFieldsLifecycleTest::assertFieldSettings

Same name in other branches
  1. 11.x core/modules/field_ui/tests/src/Functional/ManageFieldsLifecycleTest.php \Drupal\Tests\field_ui\Functional\ManageFieldsLifecycleTest::assertFieldSettings()

Asserts field settings are as expected.

@internal

Parameters

string $bundle: The bundle name for the field.

string $field_name: The field name for the field.

string $string: The settings text.

string $entity_type: The entity type for the field.

1 call to ManageFieldsLifecycleTest::assertFieldSettings()
ManageFieldsLifecycleTest::updateField in core/modules/field_ui/tests/src/Functional/ManageFieldsLifecycleTest.php
Tests editing an existing field.

File

core/modules/field_ui/tests/src/Functional/ManageFieldsLifecycleTest.php, line 314

Class

ManageFieldsLifecycleTest
Tests the Field UI "Manage fields" screen.

Namespace

Drupal\Tests\field_ui\Functional

Code

protected function assertFieldSettings(string $bundle, string $field_name, string $string = 'dummy test string', string $entity_type = 'node') : void {
    // Assert field storage settings.
    $field_storage = FieldStorageConfig::loadByName($entity_type, $field_name);
    $this->assertSame($string, $field_storage->getSetting('test_field_storage_setting'), 'Field storage settings were found.');
    // Assert field settings.
    $field = FieldConfig::loadByName($entity_type, $bundle, $field_name);
    $this->assertSame($string, $field->getSetting('test_field_setting'), 'Field settings were found.');
}

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