You are here

protected function UpdatePathTestBase::setUp in Zircon Profile 8

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

Overrides WebTestBase::setUp() for update testing.

The main difference in this method is that rather than performing the installation via the installer, a database is loaded. Additional work is then needed to set various things such as the config directories and the container that would normally be done via the installer.

Overrides WebTestBase::setUp

6 calls to UpdatePathTestBase::setUp()
FieldUpdateTest::setUp in core/modules/field/src/Tests/Update/FieldUpdateTest.php
Overrides WebTestBase::setUp() for update testing.
LocalActionsAndTasksConvertedIntoBlocksUpdateTest::setUp in core/modules/system/src/Tests/Update/LocalActionsAndTasksConvertedIntoBlocksUpdateTest.php
Overrides WebTestBase::setUp() for update testing.
PageTitleConvertedIntoBlockUpdateTest::setUp in core/modules/system/src/Tests/Update/PageTitleConvertedIntoBlockUpdateTest.php
Overrides WebTestBase::setUp() for update testing.
SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest::setUp in core/modules/system/src/Tests/Update/SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest.php
Overrides WebTestBase::setUp() for update testing.
SiteBrandingConvertedIntoBlockUpdateTest::setUp in core/modules/system/src/Tests/Update/SiteBrandingConvertedIntoBlockUpdateTest.php
Overrides WebTestBase::setUp() for update testing.

... See full list

6 methods override UpdatePathTestBase::setUp()
FieldUpdateTest::setUp in core/modules/field/src/Tests/Update/FieldUpdateTest.php
Overrides WebTestBase::setUp() for update testing.
LocalActionsAndTasksConvertedIntoBlocksUpdateTest::setUp in core/modules/system/src/Tests/Update/LocalActionsAndTasksConvertedIntoBlocksUpdateTest.php
Overrides WebTestBase::setUp() for update testing.
PageTitleConvertedIntoBlockUpdateTest::setUp in core/modules/system/src/Tests/Update/PageTitleConvertedIntoBlockUpdateTest.php
Overrides WebTestBase::setUp() for update testing.
SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest::setUp in core/modules/system/src/Tests/Update/SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest.php
Overrides WebTestBase::setUp() for update testing.
SiteBrandingConvertedIntoBlockUpdateTest::setUp in core/modules/system/src/Tests/Update/SiteBrandingConvertedIntoBlockUpdateTest.php
Overrides WebTestBase::setUp() for update testing.

... See full list

File

core/modules/system/src/Tests/Update/UpdatePathTestBase.php, line 153
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 setUp() {
  $this
    ->runDbTasks();

  // Allow classes to set database dump files.
  $this
    ->setDatabaseDumpFiles();

  // We are going to set a missing zlib requirement property for usage
  // during the performUpgrade() and tearDown() methods. Also set that the
  // tests failed.
  if (!$this->zlibInstalled) {
    parent::setUp();
    return;
  }

  // Set the update url. This must be set here rather than in
  // self::__construct() or the old URL generator will leak additional test
  // sites.
  $this->updateUrl = Url::fromRoute('system.db_update');

  // These methods are called from parent::setUp().
  $this
    ->setBatch();
  $this
    ->initUserSession();
  $this
    ->prepareSettings();

  // Load the database(s).
  foreach ($this->databaseDumpFiles as $file) {
    if (substr($file, -3) == '.gz') {
      $file = "compress.zlib://{$file}";
    }
    require $file;
  }
  $this
    ->initSettings();
  $request = Request::createFromGlobals();
  $container = $this
    ->initKernel($request);
  $this
    ->initConfig($container);

  // Add the config directories to settings.php.
  drupal_install_config_directories();

  // Restore the original Simpletest batch.
  $this
    ->restoreBatch();

  // Set the container. parent::rebuildAll() would normally do this, but this
  // not safe to do here, because the database has not been updated yet.
  $this->container = \Drupal::getContainer();
  $this
    ->replaceUser1();
}