You are here

protected function UpdateTestBase::setUp in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/update/src/Tests/UpdateTestBase.php \Drupal\update\Tests\UpdateTestBase::setUp()

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Overrides WebTestBase::setUp

4 calls to UpdateTestBase::setUp()
UpdateContribTest::setUp in core/modules/update/src/Tests/UpdateContribTest.php
Sets up a Drupal site for running functional and integration tests.
UpdateCoreTest::setUp in core/modules/update/src/Tests/UpdateCoreTest.php
Sets up a Drupal site for running functional and integration tests.
UpdateDeleteFileIfStaleTest::setUp in core/modules/update/src/Tests/UpdateDeleteFileIfStaleTest.php
Sets up a Drupal site for running functional and integration tests.
UpdateUploadTest::setUp in core/modules/update/src/Tests/UpdateUploadTest.php
Sets up a Drupal site for running functional and integration tests.
4 methods override UpdateTestBase::setUp()
UpdateContribTest::setUp in core/modules/update/src/Tests/UpdateContribTest.php
Sets up a Drupal site for running functional and integration tests.
UpdateCoreTest::setUp in core/modules/update/src/Tests/UpdateCoreTest.php
Sets up a Drupal site for running functional and integration tests.
UpdateDeleteFileIfStaleTest::setUp in core/modules/update/src/Tests/UpdateDeleteFileIfStaleTest.php
Sets up a Drupal site for running functional and integration tests.
UpdateUploadTest::setUp in core/modules/update/src/Tests/UpdateUploadTest.php
Sets up a Drupal site for running functional and integration tests.

File

core/modules/update/src/Tests/UpdateTestBase.php, line 33
Contains \Drupal\update\Tests\UpdateTestBase.

Class

UpdateTestBase
Defines some shared functions used by all update tests.

Namespace

Drupal\update\Tests

Code

protected function setUp() {
  parent::setUp();

  // Change the root path which Update Manager uses to install and update
  // projects to be inside the testing site directory. See
  // \Drupal\update\UpdateRootFactory::get() for equivalent changes to the
  // test child site.
  $request = \Drupal::request();
  $update_root = $this->container
    ->get('update.root') . '/' . DrupalKernel::findSitePath($request);
  $this->container
    ->set('update.root', $update_root);
  \Drupal::setContainer($this->container);

  // Create the directories within the root path within which the Update
  // Manager will install projects.
  foreach (drupal_get_updaters() as $updater_info) {
    $updater = $updater_info['class'];
    $install_directory = $update_root . '/' . $updater::getRootDirectoryRelativePath();
    if (!is_dir($install_directory)) {
      mkdir($install_directory);
    }
  }
}