You are here

public function SqlTest::testEnsureTables in Drupal 10

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Kernel/Plugin/id_map/SqlTest.php \Drupal\Tests\migrate\Kernel\Plugin\id_map\SqlTest::testEnsureTables()

Tests that ensureTables creates the migrate map table.

@dataProvider providerTestEnsureTables

File

core/modules/migrate/tests/src/Kernel/Plugin/id_map/SqlTest.php, line 86

Class

SqlTest
Tests that the migrate map table is created.

Namespace

Drupal\Tests\migrate\Kernel\Plugin\id_map

Code

public function testEnsureTables($ids) {
  $this->migrationDefinition['source']['ids'] = $ids;
  $migration = $this->migrationPluginManager
    ->createStubMigration($this->migrationDefinition);
  $map = new TestSqlIdMap($this->database, [], 'test', [], $migration, $this->eventDispatcher);
  $map
    ->ensureTables();

  // Checks that the map table was created.
  $exists = $this->database
    ->schema()
    ->tableExists('migrate_map_test');
  $this
    ->assertTrue($exists);
}