You are here

protected function KernelTestBase::setUpFilesystem in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::setUpFilesystem()
  2. 10 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::setUpFilesystem()

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

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

File

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

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