function CrudTest::testUpdateFieldType

File

drupal/core/modules/field/lib/Drupal/field/Tests/CrudTest.php, line 365
Definition of Drupal\field\Tests\CrudTest.

Class

CrudTest

Namespace

Drupal\field\Tests

Code

function testUpdateFieldType() {
  $field = array(
    'field_name' => 'field_type',
    'type' => 'number_decimal',
  );
  $field = field_create_field($field);
  $test_field = array(
    'field_name' => 'field_type',
    'type' => 'number_integer',
  );
  try {
    field_update_field($test_field);
    $this
      ->fail(t('Cannot update a field to a different type.'));
  } catch (FieldException $e) {
    $this
      ->pass(t('Cannot update a field to a different type.'));
  }
}