protected function EntityDefinitionTestTrait::addRevisionableBaseField in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php \Drupal\system\Tests\Entity\EntityDefinitionTestTrait::addRevisionableBaseField()
Adds a new revisionable base field to the 'entity_test_update' entity type.
Parameters
string $type: (optional) The field type for the new field. Defaults to 'string'.
2 calls to EntityDefinitionTestTrait::addRevisionableBaseField()
- EntityDefinitionUpdateTest::testEntityTypeSchemaUpdateAndRevisionableBaseFieldCreateWithoutData in core/
modules/ system/ src/ Tests/ Entity/ EntityDefinitionUpdateTest.php - Tests updating entity schema and creating a revisionable base field.
- EntityDefinitionUpdateTest::testSingleActionCalls in core/
modules/ system/ src/ Tests/ Entity/ EntityDefinitionUpdateTest.php - Tests applying single updates.
File
- core/
modules/ system/ src/ Tests/ Entity/ EntityDefinitionTestTrait.php, line 127 - Contains \Drupal\system\Tests\Entity\EntityDefinitionTestTrait.
Class
- EntityDefinitionTestTrait
- Provides some test methods used to update existing entity definitions.
Namespace
Drupal\system\Tests\EntityCode
protected function addRevisionableBaseField($type = 'string') {
$definitions['new_base_field'] = BaseFieldDefinition::create($type)
->setName('new_base_field')
->setLabel(t('A new revisionable base field'))
->setRevisionable(TRUE);
$this->state
->set('entity_test_update.additional_base_field_definitions', $definitions);
}