You are here

protected function FeaturesUserTestCase::_test_field_instance in Features 7.2

Loads or saves an example field instance for testing.

Parameters

string $op: One of 'load' or 'override'.

Return value

array|null|void If $op === 'load': The 'node-features_test-field_features_test' field instance, or NULL if the field instance does not exist. If $op === 'override': No return value (null/void). The 'node-features_test-field_features_test' field instance will be modified, setting the label to 'Foo bar'.

Throws

\FieldException In field_update_instance().

File

tests/features.test, line 126
Contains test classes for features module.

Class

FeaturesUserTestCase
User permission component tests for Features.

Code

protected function _test_field_instance($op = 'load') {
  switch ($op) {
    case 'load':
      return field_info_instance('node', 'field_features_test', 'features_test');
    case 'override':
      $field_instance = field_info_instance('node', 'field_features_test', 'features_test');
      $field_instance['label'] = 'Foo bar';
      field_update_instance($field_instance);
      break;
  }
}