You are here

public function MigrateSqlIdMapTest::testMapTableCreation in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testMapTableCreation()

Tests the delayed creation of the "map" and "message" migrate tables.

File

core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php, line 1054

Class

MigrateSqlIdMapTest
Tests the SQL ID map plugin.

Namespace

Drupal\Tests\migrate\Unit

Code

public function testMapTableCreation() {
  $id_map = $this
    ->getIdMap();
  $map_table_name = $id_map
    ->mapTableName();
  $message_table_name = $id_map
    ->messageTableName();

  // Check that tables names do exist.
  $this
    ->assertEquals('migrate_map_sql_idmap_test', $map_table_name);
  $this
    ->assertEquals('migrate_message_sql_idmap_test', $message_table_name);

  // Check that tables don't exist.
  $this
    ->assertFalse($this->database
    ->schema()
    ->tableExists($map_table_name));
  $this
    ->assertFalse($this->database
    ->schema()
    ->tableExists($message_table_name));
  $id_map
    ->getDatabase();

  // Check that tables do exist.
  $this
    ->assertTrue($this->database
    ->schema()
    ->tableExists($map_table_name));
  $this
    ->assertTrue($this->database
    ->schema()
    ->tableExists($message_table_name));
}