1 field.test FieldCrudTestCase::testUpdateFieldForbid()

Test field type modules forbidding an update.

File

core/modules/field/tests/field.test, line 2490
Tests for field.module.

Class

FieldCrudTestCase

Code

function testUpdateFieldForbid() {
  $field = array('field_name' => 'forbidden', 'type' => 'test_field', 'settings' => array('changeable' => 0, 'unchangeable' => 0));
  $field = field_create_field($field);
  $field['settings']['changeable']++;
  try {
    field_update_field($field);
    $this->pass(t("A changeable setting can be updated."));
  }
  catch (FieldException $e) {
    $this->fail(t("An unchangeable setting cannot be updated."));
  }
  $field['settings']['unchangeable']++;
  try {
    field_update_field($field);
    $this->fail(t("An unchangeable setting can be updated."));
  }
  catch (FieldException $e) {
    $this->pass(t("An unchangeable setting cannot be updated."));
  }
}