function MigrateSqlIdMapTest::testGetQualifiedMapTablePrefix

Same name in other branches
  1. 8.9.x core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testGetQualifiedMapTablePrefix()
  2. 10 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testGetQualifiedMapTablePrefix()
  3. 11.x core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testGetQualifiedMapTablePrefix()

Tests the getQualifiedMapTable method with a prefixed database.

File

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

Class

MigrateSqlIdMapTest
Tests the SQL ID map plugin.

Namespace

Drupal\Tests\migrate\Unit

Code

public function testGetQualifiedMapTablePrefix() {
    $connection_options = [
        'database' => ':memory:',
        'prefix' => 'prefix',
    ];
    $pdo = Connection::open($connection_options);
    $this->database = new Connection($pdo, $connection_options);
    $qualified_map_table = $this->getIdMap()
        ->getQualifiedMapTableName();
    // The SQLite driver is a special flower. It will prefix tables with
    // PREFIX.TABLE, instead of the standard PREFIXTABLE.
    // @see \Drupal\sqlite\Driver\Database\sqlite\Connection::__construct()
    $this->assertEquals('prefix.migrate_map_sql_idmap_test', $qualified_map_table);
}

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