You are here

protected function TestSiteInstallCommand::ensureDirectory in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php \Drupal\TestSite\Commands\TestSiteInstallCommand::ensureDirectory()
  2. 9 core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php \Drupal\TestSite\Commands\TestSiteInstallCommand::ensureDirectory()

Ensures that the sites/simpletest directory exists and is writable.

Parameters

string $root: The Drupal root.

1 call to TestSiteInstallCommand::ensureDirectory()
TestSiteInstallCommand::execute in core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php

File

core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php, line 164

Class

TestSiteInstallCommand
Command to create a test Drupal site.

Namespace

Drupal\TestSite\Commands

Code

protected function ensureDirectory($root) {
  if (!is_writable($root . '/sites/simpletest')) {
    if (!@mkdir($root . '/sites/simpletest')) {
      throw new \RuntimeException($root . '/sites/simpletest must exist and be writable to install a test site');
    }
  }
}