function UpdateUploaderTestBase::setUp

Same name in other branches
  1. 10 core/modules/update/tests/src/Functional/UpdateUploaderTestBase.php \Drupal\Tests\update\Functional\UpdateUploaderTestBase::setUp()
  2. 11.x core/modules/update/tests/src/Functional/UpdateUploaderTestBase.php \Drupal\Tests\update\Functional\UpdateUploaderTestBase::setUp()

Overrides BrowserTestBase::setUp

2 calls to UpdateUploaderTestBase::setUp()
FileTransferAuthorizeFormTest::setUp in core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php
UpdateUploadTest::setUp in core/modules/update/tests/src/Functional/UpdateUploadTest.php
2 methods override UpdateUploaderTestBase::setUp()
FileTransferAuthorizeFormTest::setUp in core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php
UpdateUploadTest::setUp in core/modules/update/tests/src/Functional/UpdateUploadTest.php

File

core/modules/update/tests/src/Functional/UpdateUploaderTestBase.php, line 15

Class

UpdateUploaderTestBase
Base test class for tests that test project upload functionality.

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
        ->get('update.root')
        ->set($update_root);
    // 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);
        }
    }
}

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