function MigrateSqlIdMapTest::testMapTableCreation

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testMapTableCreation()
  2. 10 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testMapTableCreation()
  3. 11.x 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));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.