function MigrateUpgradeTestBase::createMigrationConnection
Same name in other branches
- 9 core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php \Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeTestBase::createMigrationConnection()
- 8.9.x core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php \Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeTestBase::createMigrationConnection()
- 11.x core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php \Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeTestBase::createMigrationConnection()
Changes the database connection to the prefixed one.
@todo Remove when we don't use global. https://www.drupal.org/node/2552791
3 calls to MigrateUpgradeTestBase::createMigrationConnection()
- MigrateMessageControllerTest::testDetail in core/
modules/ migrate_drupal_ui/ tests/ src/ Functional/ MigrateMessageControllerTest.php - Tests the detail pages for migrate messages.
- MigrateMessageControllerTest::testOverview in core/
modules/ migrate_drupal_ui/ tests/ src/ Functional/ MigrateMessageControllerTest.php - Tests the overview page for migrate messages.
- MigrateUpgradeTestBase::setUp in core/
modules/ migrate_drupal_ui/ tests/ src/ Functional/ MigrateUpgradeTestBase.php
File
-
core/
modules/ migrate_drupal_ui/ tests/ src/ Functional/ MigrateUpgradeTestBase.php, line 100
Class
- MigrateUpgradeTestBase
- Provides a base class for testing migration upgrades in the UI.
Namespace
Drupal\Tests\migrate_drupal_ui\FunctionalCode
protected function createMigrationConnection() {
$connection_info = Database::getConnectionInfo('default')['default'];
if ($connection_info['driver'] === 'sqlite') {
// Create database file in the test site's public file directory so that
// \Drupal\Tests\BrowserTestBase::cleanupEnvironment() will delete this
// once the test is complete.
$file = $this->publicFilesDirectory . '/' . $this->testId . '-migrate.db.sqlite';
touch($file);
$connection_info['database'] = $file;
$connection_info['prefix'] = '';
}
else {
$prefix = $connection_info['prefix'];
// Test databases use fixed length prefixes. Create a new prefix for the
// source database. Adding to the end of the prefix ensures that
// \Drupal\Tests\BrowserTestBase::cleanupEnvironment() will remove the
// additional tables.
$connection_info['prefix'] = $prefix . '0';
}
Database::addConnectionInfo('migrate_drupal_ui', 'default', $connection_info);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.