protected function UpdatePathTestBase::runDbTasks in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php \Drupal\FunctionalTests\Update\UpdatePathTestBase::runDbTasks()
Runs the install database tasks for the driver used by the test runner.
2 calls to UpdatePathTestBase::runDbTasks()
- UpdatePathTestBase::doInstall in core/
tests/ Drupal/ FunctionalTests/ Update/ UpdatePathTestBase.php - Execute the non-interactive installer.
- UpdatePathTestBase::setUp in core/
tests/ Drupal/ FunctionalTests/ Update/ UpdatePathTestBase.php - Overrides BrowserTestBase::setUp() for update testing.
File
- core/
tests/ Drupal/ FunctionalTests/ Update/ UpdatePathTestBase.php, line 276
Class
- UpdatePathTestBase
- Provides a base class for writing an update test.
Namespace
Drupal\FunctionalTests\UpdateCode
protected function runDbTasks() {
// Create a minimal container so that t() works.
// @see install_begin_request()
$container = new ContainerBuilder();
$container
->setParameter('language.default_values', Language::$defaultValues);
$container
->register('language.default', 'Drupal\\Core\\Language\\LanguageDefault')
->addArgument('%language.default_values%');
$container
->register('string_translation', 'Drupal\\Core\\StringTranslation\\TranslationManager')
->addArgument(new Reference('language.default'));
\Drupal::setContainer($container);
require_once __DIR__ . '/../../../../includes/install.inc';
$connection_info = Database::getConnectionInfo();
$driver = $connection_info['default']['driver'];
$namespace = $connection_info['default']['namespace'] ?? NULL;
$errors = db_installer_object($driver, $namespace)
->runTasks();
if (!empty($errors)) {
$this
->fail('Failed to run installer database tasks: ' . implode(', ', $errors));
}
}