protected function prepareEnvironment() { // Bootstrap Drupal so we can use Drupal's built in functions.
$this->classLoader =
require __DIR__ . '/../../../../../autoload.php';
$request = Request::
createFromGlobals();
$kernel = TestRunnerKernel::
createFromRequest($request,
$this->classLoader
);
// TestRunnerKernel expects the working directory to be DRUPAL_ROOT.
chdir(DRUPAL_ROOT
);
$kernel->
boot();
$kernel->
preHandle($request);
$this->
prepareDatabasePrefix();
$this->originalSite =
$kernel->
findSitePath($request);
// Create test directory ahead of installation so fatal errors and debug
// information can be logged during installation process.
\Drupal::
service('file_system'
)->
prepareDirectory($this->siteDirectory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS
);
// Prepare filesystem directory paths.
$this->publicFilesDirectory =
$this->siteDirectory . '/files';
$this->privateFilesDirectory =
$this->siteDirectory . '/private';
$this->tempFilesDirectory =
$this->siteDirectory . '/temp';