function MigrateMissingDatabaseTest::testMissingDatabase
Same name in this branch
- 10 core/modules/migrate_drupal/tests/src/Kernel/MigrateMissingDatabaseTest.php \Drupal\Tests\migrate_drupal\Kernel\MigrateMissingDatabaseTest::testMissingDatabase()
Same name in other branches
- 11.x core/modules/migrate_drupal/tests/src/Kernel/MigrateMissingDatabaseTest.php \Drupal\Tests\migrate_drupal\Kernel\MigrateMissingDatabaseTest::testMissingDatabase()
- 11.x core/modules/migrate/tests/src/Kernel/MigrateMissingDatabaseTest.php \Drupal\Tests\migrate\Kernel\MigrateMissingDatabaseTest::testMissingDatabase()
Tests a SQL migration without the database connection.
- The migration can be instantiated.
- The checkRequirements() method throws a RequirementsException.
File
-
core/
modules/ migrate/ tests/ src/ Kernel/ MigrateMissingDatabaseTest.php, line 51
Class
- MigrateMissingDatabaseTest
- Tests that a SQL migration can be instantiated without a database connection.
Namespace
Drupal\Tests\migrate\KernelCode
public function testMissingDatabase() : void {
if (Database::getConnection()->driver() === 'sqlite') {
$this->markTestSkipped('Not compatible with sqlite');
}
$migration = $this->migrationPluginManager
->createInstance('missing_database');
$this->assertInstanceOf(MigrationInterface::class, $migration);
$this->assertInstanceOf(MigrateIdMapInterface::class, $migration->getIdMap());
$this->expectException(RequirementsException::class);
$this->expectExceptionMessage('No database connection available for source plugin migrate_missing_database_test');
$migration->checkRequirements();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.