Issue #2504417 by alexpott: Fix Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testGetQualifiedMapTablePrefix()

8.0.x
Nathaniel Catchpole 2015-06-11 13:25:11 +01:00
parent 5e6c61d449
commit 975c164261
1 changed files with 8 additions and 7 deletions

View File

@ -7,6 +7,7 @@
namespace Drupal\Tests\migrate\Unit; namespace Drupal\Tests\migrate\Unit;
use Drupal\Core\Database\Driver\sqlite\Connection;
use Drupal\migrate\Entity\MigrationInterface; use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\MigrateException; use Drupal\migrate\MigrateException;
use Drupal\migrate\Plugin\MigrateIdMapInterface; use Drupal\migrate\Plugin\MigrateIdMapInterface;
@ -742,18 +743,18 @@ class MigrateSqlIdMapTest extends MigrateTestCase {
* Tests the getQualifiedMapTable method with a prefixed database. * Tests the getQualifiedMapTable method with a prefixed database.
*/ */
public function testGetQualifiedMapTablePrefix() { public function testGetQualifiedMapTablePrefix() {
$this->database = $this->getDatabase([], ['database' => 'source_database', 'prefix' => 'prefix']); $connection_options = [
'database' => ':memory:',
'prefix' => 'prefix',
];
$pdo = Connection::open($connection_options);
$this->database = new Connection($pdo, $connection_options);
$qualified_map_table = $this->getIdMap()->getQualifiedMapTableName(); $qualified_map_table = $this->getIdMap()->getQualifiedMapTableName();
// The SQLite driver is a special flower. It will prefix tables with // The SQLite driver is a special flower. It will prefix tables with
// PREFIX.TABLE, instead of the standard PREFIXTABLE. // PREFIX.TABLE, instead of the standard PREFIXTABLE.
// @see \Drupal\Core\Database\Driver\sqlite\Connection::__construct() // @see \Drupal\Core\Database\Driver\sqlite\Connection::__construct()
if ($this->database->driver() == 'sqlite') {
$this->assertEquals('prefix.migrate_map_sql_idmap_test', $qualified_map_table); $this->assertEquals('prefix.migrate_map_sql_idmap_test', $qualified_map_table);
} }
else {
$this->assertEquals('source_database.prefixmigrate_map_sql_idmap_test', $qualified_map_table);
}
}
/** /**
* Tests all the iterator methods in one swing. * Tests all the iterator methods in one swing.