You are here

protected function EntityDefinitionTestTrait::addEntityIndex in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php \Drupal\system\Tests\Entity\EntityDefinitionTestTrait::addEntityIndex()

Adds an index to the 'entity_test_update' entity type's base table.

See also

\Drupal\entity_test\EntityTestStorageSchema::getEntitySchema().

2 calls to EntityDefinitionTestTrait::addEntityIndex()
EntityDefinitionUpdateTest::testEntityIndexCreateDeleteWithoutData in core/modules/system/src/Tests/Entity/EntityDefinitionUpdateTest.php
Tests creating and deleting a multi-field index when there are no existing entities.
EntityDefinitionUpdateTest::testEntityIndexCreateWithData in core/modules/system/src/Tests/Entity/EntityDefinitionUpdateTest.php
Tests creating a multi-field index when there are existing entities.

File

core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php, line 209
Contains \Drupal\system\Tests\Entity\EntityDefinitionTestTrait.

Class

EntityDefinitionTestTrait
Provides some test methods used to update existing entity definitions.

Namespace

Drupal\system\Tests\Entity

Code

protected function addEntityIndex() {
  $indexes = array(
    'entity_test_update__new_index' => array(
      'name',
      'user_id',
    ),
  );
  $this->state
    ->set('entity_test_update.additional_entity_indexes', $indexes);
}