Same name and namespace in other branches
  1. 8.9.x core/modules/system/tests/modules/entity_test/entity_test.install \entity_test_install()
  2. 9 core/modules/system/tests/modules/entity_test/entity_test.install \entity_test_install()

Implements hook_install().

3 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
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
Install, update and uninstall functions for the entity_test module.

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();
  }
}