You are here

public function SmartSqlTest::testMapTableCreation in Smart SQL ID Map 1.0.x

Same name and namespace in other branches
  1. 1.1.x tests/src/Unit/Plugin/migrate/id_map/SmartSqlTest.php \Drupal\Tests\smart_sql_idmap\Unit\Plugin\migrate\id_map\SmartSqlTest::testMapTableCreation()

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

Overrides MigrateSqlIdMapTest::testMapTableCreation

File

tests/src/Unit/Plugin/migrate/id_map/SmartSqlTest.php, line 471

Class

SmartSqlTest
Tests the Smart SQL ID map plugin.

Namespace

Drupal\Tests\smart_sql_idmap\Unit\Plugin\migrate\id_map

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($this->expectedMapTableName, $map_table_name);
  $this
    ->assertEquals($this->expectedMessageTableName, $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));
}