You are here

public function DerUpdate8202Test::testUpdate8202 in Dynamic Entity Reference 8.2

Test that the _int column indexes are properly created.

See also

\dynamic_entity_reference_update_8202()

File

tests/src/Functional/Update/DerUpdate8202Test.php, line 34

Class

DerUpdate8202Test
Tests DER update path from 8201 and on.

Namespace

Drupal\Tests\dynamic_entity_reference\Functional\Update

Code

public function testUpdate8202() {

  // The index should not exist initially.
  $schema = \Drupal::database()
    ->schema();
  $index_mapping = [
    // Table => index name.
    'entity_test__field_test' => 'field_test_target_id_int',
    'entity_test_mul__field_test_mul' => 'field_test_mul_target_id_int',
  ];
  foreach ($index_mapping as $table => $index_name) {
    $this
      ->assertFalse($schema
      ->indexExists($table, $index_name));
  }

  // Run updates and verify the indexes have been created.
  $this
    ->runUpdates();
  foreach ($index_mapping as $table => $index_name) {
    $this
      ->assertTrue($schema
      ->indexExists($table, $index_name));
  }
}