function UpdatePathTestBase::runDbTasks

Same name and namespace in other branches
  1. 9 core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php \Drupal\FunctionalTests\Update\UpdatePathTestBase::runDbTasks()
  2. 8.9.x core/modules/system/src/Tests/Update/UpdatePathTestBase.php \Drupal\system\Tests\Update\UpdatePathTestBase::runDbTasks()
  3. 8.9.x core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php \Drupal\FunctionalTests\Update\UpdatePathTestBase::runDbTasks()
  4. 11.x 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.

3 calls to UpdatePathTestBase::runDbTasks()
Mysql8RequirePrimaryKeyUpdateTest::runDbTasks in core/modules/mysql/tests/src/Functional/Mysql8RequirePrimaryKeyUpdateTest.php
Runs the install database tasks for the driver used by the test runner.
PostgreSqlSequenceUpdateTest::runDbTasks in core/modules/pgsql/tests/src/Functional/Database/PostgreSqlSequenceUpdateTest.php
Runs the install database tasks for the driver used by the test runner.
UpdatePathTestBase::doInstall in core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
Execute the non-interactive installer.
2 methods override UpdatePathTestBase::runDbTasks()
Mysql8RequirePrimaryKeyUpdateTest::runDbTasks in core/modules/mysql/tests/src/Functional/Mysql8RequirePrimaryKeyUpdateTest.php
Runs the install database tasks for the driver used by the test runner.
PostgreSqlSequenceUpdateTest::runDbTasks in core/modules/pgsql/tests/src/Functional/Database/PostgreSqlSequenceUpdateTest.php
Runs the install database tasks for the driver used by the test runner.

File

core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php, line 212

Class

UpdatePathTestBase
Provides a base class for writing an update test.

Namespace

Drupal\FunctionalTests\Update

Code

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);
  // Run database tasks and check for errors.
  $installer_class = Database::getConnectionInfo()['default']['namespace'] . "\\Install\\Tasks";
  $errors = (new $installer_class())->runTasks();
  if (!empty($errors)) {
    $this->fail('Failed to run installer database tasks: ' . implode(', ', $errors));
  }
}

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