function SqlTest::testEnsureTables

Same name 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()
  2. 10 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) : void {
    $this->migrationDefinition['source']['ids'] = $ids;
    $migration = $this->migrationPluginManager
        ->createStubMigration($this->migrationDefinition);
    $map = new TestSqlIdMap($this->database, [], 'test', [], $migration, $this->eventDispatcher, $this->migrationPluginManager);
    $map->ensureTables();
    // Checks that the map table was created.
    $exists = $this->database
        ->schema()
        ->tableExists('migrate_map_test');
    $this->assertTrue($exists);
}

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