function ThemeTest::prepareEnvironment

Prepares the current environment for running the test.

Also sets up new resources for the testing environment, such as the public filesystem and configuration directories.

Overrides FunctionalTestSetupTrait::prepareEnvironment

File

core/modules/system/tests/src/Functional/System/ThemeTest.php, line 73

Class

ThemeTest
Tests the theme administration user interface.

Namespace

Drupal\Tests\system\Functional\System

Code

protected function prepareEnvironment() : void {
  parent::prepareEnvironment();
  // Create theme for testing semver.
  \Drupal::service('file_system')->mkdir($this->publicFilesDirectory . '/../themes/test_core_semver', NULL, TRUE);
  $contents = <<<INFO
  name: 'Theme test with semver core version'
  type: theme
  base theme: false
  description: 'Test theme which has semver core version.'
  version: VERSION
  
  INFO;
  // Add the core_version_requirement key.
  $version = explode('.', \Drupal::VERSION, 2);
  $contents .= "core_version_requirement: ^{$version[0]}\n";
  file_put_contents($this->publicFilesDirectory . '/../themes/test_core_semver/test_core_semver.info.yml', $contents);
}

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