public static function Drush_TestCase::setUpFreshSandBox

6.x drush_testcase.inc public static Drush_TestCase::setUpFreshSandBox()
5.x drush_testcase.inc public static Drush_TestCase::setUpFreshSandBox()

Remove any pre-existing sandbox, then create a new one.

1 call to Drush_TestCase::setUpFreshSandBox()
Drush_TestCase::setUpBeforeClass in tests/drush_testcase.inc
Assure that each class starts with an empty sandbox directory and a clean environment - http://drupal.org/node/1103568.

File

tests/drush_testcase.inc, line 26
Initialize a sandboxed environment. Starts with call unish_init() at bottom.

Class

Drush_TestCase

Code

public static function setUpFreshSandBox() {
  $sandbox = UNISH_SANDBOX;
  if (file_exists($sandbox)) {
    unish_file_delete_recursive($sandbox);
  }
  $ret = mkdir($sandbox, 0777, TRUE);
  chdir(UNISH_SANDBOX);

  mkdir(getenv('HOME') . '/.drush', 0777, TRUE);
  mkdir($sandbox . '/etc/drush', 0777, TRUE);
  mkdir($sandbox . '/share/drush/commands', 0777, TRUE);

  if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
    // Hack to make git use unix line endings on windows
    // We need it to make hashes of files pulled from git match ones hardcoded in tests
    if (!file_exists($sandbox . '\home')) {
      mkdir($sandbox . '\home');
    }
    exec("git config --file $sandbox\\home\\.gitconfig core.autocrlf false", $output, $return);
  }
}