function entity_test_install
Same name in other branches
- 9 core/modules/system/tests/modules/entity_test/entity_test.install \entity_test_install()
- 8.9.x core/modules/system/tests/modules/entity_test/entity_test.install \entity_test_install()
- 11.x core/modules/system/tests/modules/entity_test/entity_test.install \entity_test_install()
Implements hook_install().
4 calls to entity_test_install()
- EntityFieldTest::setUp in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityFieldTest.php - EntityLanguageTestBase::setUp in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityLanguageTestBase.php - EntityValidationTest::setUp in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityValidationTest.php - FieldAccessTest::setUp in core/
tests/ Drupal/ KernelTests/ Core/ Field/ FieldAccessTest.php
2 string references to 'entity_test_install'
- testing_config_overrides.info.yml in core/
profiles/ testing_config_overrides/ testing_config_overrides.info.yml - core/profiles/testing_config_overrides/testing_config_overrides.info.yml
- user.role.authenticated.yml in core/
profiles/ testing_config_overrides/ config/ install/ user.role.authenticated.yml - core/profiles/testing_config_overrides/config/install/user.role.authenticated.yml
File
-
core/
modules/ system/ tests/ modules/ entity_test/ entity_test.install, line 14
Code
function entity_test_install() {
foreach (entity_test_entity_types() as $entity_type) {
// Auto-create fields for testing.
FieldStorageConfig::create([
'entity_type' => $entity_type,
'field_name' => 'field_test_text',
'type' => 'text',
'cardinality' => 1,
])->save();
FieldConfig::create([
'entity_type' => $entity_type,
'field_name' => 'field_test_text',
'bundle' => $entity_type,
'label' => 'Test text-field',
'translatable' => FALSE,
])->save();
\Drupal::service('entity_display.repository')->getFormDisplay($entity_type, $entity_type)
->setComponent('field_test_text', [
'type' => 'text_textfield',
])
->save();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.