function DependencyTest::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/ Module/ DependencyTest.php, line 27
Class
- DependencyTest
- Enable module without dependency enabled.
Namespace
Drupal\Tests\system\Functional\ModuleCode
protected function prepareEnvironment() : void {
parent::prepareEnvironment();
// Create a module for testing semver support.
\Drupal::service('file_system')->mkdir($this->publicFilesDirectory . '/../modules/system_core_semver_test', NULL, TRUE);
$contents = <<<INFO
name: 'System core ^8 version test'
type: module
description: 'Support module for testing core using semver.'
package: Testing
version: 1.0.0
INFO;
// Add the core_version_requirement key.
$version = explode('.', \Drupal::VERSION, 2);
$contents .= "core_version_requirement: ^{$version[0]}\n";
file_put_contents($this->publicFilesDirectory . '/../modules/system_core_semver_test/system_core_semver_test.info.yml', $contents);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.