You are here

function ManageFieldsTest::assertFieldSettings in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field_ui/src/Tests/ManageFieldsTest.php \Drupal\field_ui\Tests\ManageFieldsTest::assertFieldSettings()

Asserts field settings are as expected.

Parameters

$bundle: The bundle name for the field.

$field_name: The field name for the field.

$string: The settings text.

$entity_type: The entity type for the field.

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

File

core/modules/field_ui/src/Tests/ManageFieldsTest.php, line 333
Contains \Drupal\field_ui\Tests\ManageFieldsTest.

Class

ManageFieldsTest
Tests the Field UI "Manage fields" screen.

Namespace

Drupal\field_ui\Tests

Code

function assertFieldSettings($bundle, $field_name, $string = 'dummy test string', $entity_type = 'node') {

  // Assert field storage settings.
  $field_storage = FieldStorageConfig::loadByName($entity_type, $field_name);
  $this
    ->assertTrue($field_storage
    ->getSetting('test_field_storage_setting') == $string, 'Field storage settings were found.');

  // Assert field settings.
  $field = FieldConfig::loadByName($entity_type, $bundle, $field_name);
  $this
    ->assertTrue($field
    ->getSetting('test_field_setting') == $string, 'Field settings were found.');
}