You are here

function entity_test_install in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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/modules/system/src/Tests/Entity/EntityFieldTest.php
Performs setup tasks before each individual test method is run.
EntityLanguageTestBase::setUp in core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php
Performs setup tasks before each individual test method is run.
EntityValidationTest::setUp in core/modules/system/src/Tests/Entity/EntityValidationTest.php
Performs setup tasks before each individual test method is run.
FieldAccessTest::setUp in core/modules/system/src/Tests/Entity/FieldAccessTest.php
Performs setup tasks before each individual test method is run.

File

core/modules/system/tests/modules/entity_test/entity_test.install, line 13
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.
    entity_create('field_storage_config', array(
      'entity_type' => $entity_type,
      'field_name' => 'field_test_text',
      'type' => 'text',
      'cardinality' => 1,
    ))
      ->save();
    entity_create('field_config', array(
      'entity_type' => $entity_type,
      'field_name' => 'field_test_text',
      'bundle' => $entity_type,
      'label' => 'Test text-field',
      'translatable' => FALSE,
    ))
      ->save();
    entity_get_form_display($entity_type, $entity_type, 'default')
      ->setComponent('field_test_text', array(
      'type' => 'text_textfield',
    ))
      ->save();
  }
}