function KernelTestBase::setUpFilesystem

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::setUpFilesystem()
  2. 8.9.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::setUpFilesystem()
  3. 11.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::setUpFilesystem()

Sets up the filesystem, so things like the file directory.

1 call to KernelTestBase::setUpFilesystem()
KernelTestBase::bootEnvironment in core/tests/Drupal/KernelTests/KernelTestBase.php
Bootstraps a basic test environment.
2 methods override KernelTestBase::setUpFilesystem()
FileTestBase::setUpFilesystem in core/tests/Drupal/KernelTests/Core/File/FileTestBase.php
Sets up the filesystem, so things like the file directory.
TwigIncludeTest::setUpFilesystem in core/modules/system/tests/src/Kernel/Theme/TwigIncludeTest.php
Sets up the filesystem, so things like the file directory.

File

core/tests/Drupal/KernelTests/KernelTestBase.php, line 329

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\KernelTests

Code

protected function setUpFilesystem() {
    $test_db = new TestDatabase($this->databasePrefix);
    $test_site_path = $test_db->getTestSitePath();
    $this->vfsRoot = vfsStream::setup('root');
    $this->vfsRoot
        ->addChild(vfsStream::newDirectory($test_site_path));
    $this->siteDirectory = vfsStream::url('root/' . $test_site_path);
    mkdir($this->siteDirectory . '/files', 0775);
    mkdir($this->siteDirectory . '/files/config/sync', 0775, TRUE);
    $settings = Settings::getInstance() ? Settings::getAll() : [];
    $settings['file_public_path'] = $this->siteDirectory . '/files';
    $settings['config_sync_directory'] = $this->siteDirectory . '/files/config/sync';
    new Settings($settings);
}

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