You are here

protected function UpdatePathTestBase::runDbTasks in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/src/Tests/Update/UpdatePathTestBase.php \Drupal\system\Tests\Update\UpdatePathTestBase::runDbTasks()

Runs the install database tasks for the driver used by the test runner.

1 call to UpdatePathTestBase::runDbTasks()
UpdatePathTestBase::setUp in core/modules/system/src/Tests/Update/UpdatePathTestBase.php
Overrides WebTestBase::setUp() for update testing.

File

core/modules/system/src/Tests/Update/UpdatePathTestBase.php, line 279
Contains \Drupal\system\Tests\Update\UpdatePathTestBase.

Class

UpdatePathTestBase
Provides a base class for writing an update test.

Namespace

Drupal\system\Tests\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);
  require_once __DIR__ . '/../../../../../includes/install.inc';
  $connection = Database::getConnection();
  $errors = db_installer_object($connection
    ->driver())
    ->runTasks();
  if (!empty($errors)) {
    $this
      ->fail('Failed to run installer database tasks: ' . implode(', ', $errors));
  }
}