function FieldUIManageFieldsTestCase::assertFieldSettings

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.

1 call to FieldUIManageFieldsTestCase::assertFieldSettings()
FieldUIManageFieldsTestCase::updateField in modules/field_ui/field_ui.test
Tests editing an existing field.

File

modules/field_ui/field_ui.test, line 276

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_cache_clear();
    // 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.');
}

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