You are here

protected function UpdateTestBase::setUp in Drupal 9

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

Overrides BrowserTestBase::setUp

5 calls to UpdateTestBase::setUp()
FileTransferAuthorizeFormTest::setUp in core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php
UpdateContribTest::setUp in core/modules/update/tests/src/Functional/UpdateContribTest.php
UpdateManagerUpdateTest::setUp in core/modules/update/tests/src/Functional/UpdateManagerUpdateTest.php
UpdateSemverTestBase::setUp in core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
UpdateUploadTest::setUp in core/modules/update/tests/src/Functional/UpdateUploadTest.php
5 methods override UpdateTestBase::setUp()
FileTransferAuthorizeFormTest::setUp in core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php
UpdateContribTest::setUp in core/modules/update/tests/src/Functional/UpdateContribTest.php
UpdateManagerUpdateTest::setUp in core/modules/update/tests/src/Functional/UpdateManagerUpdateTest.php
UpdateSemverTestBase::setUp in core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
UpdateUploadTest::setUp in core/modules/update/tests/src/Functional/UpdateUploadTest.php

File

core/modules/update/tests/src/Functional/UpdateTestBase.php, line 57

Class

UpdateTestBase
Defines some shared functions used by all update tests.

Namespace

Drupal\Tests\update\Functional

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);
    }
  }
}