1 field_ui.test FieldUIManageFieldsTestCase::assertFieldSettings($bundle, $field_name, $string = 'dummy test string', $entity_type = 'node')

Asserts field settings are as expected.

Parameters

$bundle: The bundle name for the instance.

$field_name: The field name for the instance.

$string: The settings text.

$entity_type: The entity type for the instance.

File

core/modules/field_ui/tests/field_ui.test, line 355
Tests for field_ui.module.

Class

FieldUIManageFieldsTestCase
Tests the functionality of the 'Manage fields' screen.

Code

function assertFieldSettings($bundle, $field_name, $string = 'dummy test string', $entity_type = 'node') {
  // Reset the fields info.
  _field_info_collate_fields_reset();
  // Assert field settings.
  $field = field_info_field($field_name);
  $this->assertTrue($field['settings']['test_field_setting'] == $string, 'Field settings were found.');

  // Assert instance and widget settings.
  $instance = field_info_instance($entity_type, $field_name, $bundle);
  $this->assertTrue($instance['settings']['test_instance_setting'] == $string, 'Field instance settings were found.');
  $this->assertTrue($instance['widget']['settings']['test_widget_setting'] == $string, 'Field widget settings were found.');
}