You are here

public function TaxonomyEntityIndexEntityTest::testWritingToIndexTable in Taxonomy Entity Index 8

Tests operations that insert/update/delete to the index table.

File

tests/src/Kernel/TaxonomyEntityIndexEntityTest.php, line 62

Class

TaxonomyEntityIndexEntityTest
Defines a class for testing basic functionality of taxonomy_entity_index.

Namespace

Drupal\Tests\taxonomy_entity_index\Kernel

Code

public function testWritingToIndexTable() {
  $vocab = $this
    ->createVocabulary();
  $term1 = $this
    ->createTerm($vocab);
  $term2 = $this
    ->createTerm($vocab);
  $term3 = $this
    ->createTerm($vocab);
  $term4 = $this
    ->createTerm($vocab);
  $this
    ->assertThatDisabledEntityTypesDoNotWriteToTheIndex([
    $term1,
    $term2,
  ]);
  $entity = $this
    ->assertThatEntityInsertWritesToTheIndex([
    $term1,
    $term2,
    $term3,
  ]);
  $this
    ->assertThatEntityInsertWritesToTheIndex([
    $term1,
  ]);
  $entity = $this
    ->assertThatEntityUpdatesModifyTheIndex($entity, [
    $term1,
    $term2,
    $term4,
  ]);
  $this
    ->assertThatTermDeletionUpdatesTheIndex($entity, [
    $term1,
    $term2,
  ], [
    $term4,
  ]);
  $this
    ->assertThatEntityDeletionUpdatesTheIndex($entity);
}