protected function EntityDefinitionTestTrait::addBaseField 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::addBaseField()
Adds a new base field to the 'entity_test_update' entity type.
Parameters
string $type: (optional) The field type for the new field. Defaults to 'string'.
8 calls to EntityDefinitionTestTrait::addBaseField()
- EntityDefinitionTestTrait::modifyBaseField in core/
modules/ system/ src/ Tests/ Entity/ EntityDefinitionTestTrait.php - Modifies the new base field from 'string' to 'text'.
- EntityDefinitionUpdateTest::testBaseFieldCreateDeleteWithExistingEntities in core/
modules/ system/ src/ Tests/ Entity/ EntityDefinitionUpdateTest.php - Tests creating and deleting a base field if entities exist.
- EntityDefinitionUpdateTest::testBaseFieldCreateUpdateDeleteWithoutData in core/
modules/ system/ src/ Tests/ Entity/ EntityDefinitionUpdateTest.php - Tests creating, updating, and deleting a base field if no entities exist.
- EntityDefinitionUpdateTest::testBaseFieldDeleteWithExistingData in core/
modules/ system/ src/ Tests/ Entity/ EntityDefinitionUpdateTest.php - Tests deleting a base field when it has existing data.
- EntityDefinitionUpdateTest::testBaseFieldEntityKeyUpdateWithExistingData in core/
modules/ system/ src/ Tests/ Entity/ EntityDefinitionUpdateTest.php - Tests updating a base field when it has existing data.
File
- core/
modules/ system/ src/ Tests/ Entity/ EntityDefinitionTestTrait.php, line 100 - 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 addBaseField($type = 'string') {
$definitions['new_base_field'] = BaseFieldDefinition::create($type)
->setName('new_base_field')
->setLabel(t('A new base field'));
$this->state
->set('entity_test_update.additional_base_field_definitions', $definitions);
}