function TestSiteInstallCommand::ensureDirectory

Same name in other branches
  1. 9 core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php \Drupal\TestSite\Commands\TestSiteInstallCommand::ensureDirectory()
  2. 10 core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php \Drupal\TestSite\Commands\TestSiteInstallCommand::ensureDirectory()
  3. 11.x 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');
        }
    }
}

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