function FieldUIManageFieldsTestCase::assertFieldSettings in Drupal 7
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 270 - 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_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.');
}