function FieldStorageCrudTest::testUpdateFieldType
Same name in other branches
- 8.9.x core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php \Drupal\Tests\field\Kernel\FieldStorageCrudTest::testUpdateFieldType()
- 10 core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php \Drupal\Tests\field\Kernel\FieldStorageCrudTest::testUpdateFieldType()
- 11.x core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php \Drupal\Tests\field\Kernel\FieldStorageCrudTest::testUpdateFieldType()
File
-
core/
modules/ field/ tests/ src/ Kernel/ FieldStorageCrudTest.php, line 374
Class
- FieldStorageCrudTest
- Tests field storage create, read, update, and delete.
Namespace
Drupal\Tests\field\KernelCode
public function testUpdateFieldType() {
$field_storage = FieldStorageConfig::create([
'field_name' => 'field_type',
'entity_type' => 'entity_test',
'type' => 'decimal',
]);
$field_storage->save();
try {
$field_storage->set('type', 'integer');
$field_storage->save();
$this->fail('Cannot update a field to a different type.');
} catch (\Exception $e) {
$this->assertInstanceOf(FieldException::class, $e);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.