You are here

function FieldInfoTestCase::testSettingsInfo in Drupal 7

Test that the field_info settings convenience functions work.

File

modules/field/tests/field.test, line 1559
Tests for field.module.

Class

FieldInfoTestCase

Code

function testSettingsInfo() {
  $info = field_test_field_info();

  // We need to account for the existence of user_field_info_alter().
  foreach (array_keys($info) as $name) {
    $info[$name]['instance_settings']['user_register_form'] = FALSE;
  }
  foreach ($info as $type => $data) {
    $this
      ->assertIdentical(field_info_field_settings($type), $data['settings'], format_string("field_info_field_settings returns %type's field settings", array(
      '%type' => $type,
    )));
    $this
      ->assertIdentical(field_info_instance_settings($type), $data['instance_settings'], format_string("field_info_field_settings returns %type's field instance settings", array(
      '%type' => $type,
    )));
  }
  $info = field_test_field_widget_info();
  foreach ($info as $type => $data) {
    $this
      ->assertIdentical(field_info_widget_settings($type), $data['settings'], format_string("field_info_widget_settings returns %type's widget settings", array(
      '%type' => $type,
    )));
  }
  $info = field_test_field_formatter_info();
  foreach ($info as $type => $data) {
    $this
      ->assertIdentical(field_info_formatter_settings($type), $data['settings'], format_string("field_info_formatter_settings returns %type's formatter settings", array(
      '%type' => $type,
    )));
  }
}