function FieldStorageCrudTest::testUpdateFieldType in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/field/src/Tests/FieldStorageCrudTest.php \Drupal\field\Tests\FieldStorageCrudTest::testUpdateFieldType()
File
- core/
modules/ field/ src/ Tests/ FieldStorageCrudTest.php, line 370 - Contains \Drupal\field\Tests\FieldStorageCrudTest.
Class
- FieldStorageCrudTest
- Tests field storage create, read, update, and delete.
Namespace
Drupal\field\TestsCode
function testUpdateFieldType() {
$field_storage = entity_create('field_storage_config', array(
'field_name' => 'field_type',
'entity_type' => 'entity_test',
'type' => 'decimal',
));
$field_storage
->save();
try {
$field_storage
->set('type', 'integer');
$field_storage
->save();
$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.'));
}
}