function Drush_TestCase::fetchInstallDrupal

6.x drush_testcase.inc Drush_TestCase::fetchInstallDrupal($env = 'dev', $install = FALSE, $version_string = UNISH_DRUPAL_MAJOR_VERSION, $profile = NULL)
5.x drush_testcase.inc Drush_TestCase::fetchInstallDrupal($env = 'dev', $install = FALSE, $version_string = UNISH_DRUPAL_MAJOR_VERSION, $profile = NULL)
2 calls to Drush_TestCase::fetchInstallDrupal()
archiveDumpCase::archiveDump in tests/archiveDumpTest.php
Install a site and dump it to an archive.
Drush_TestCase::setUpDrupal in tests/drush_testcase.inc

File

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

Class

Drush_TestCase

Code

function fetchInstallDrupal($env = 'dev', $install = FALSE, $version_string = UNISH_DRUPAL_MAJOR_VERSION, $profile = NULL) {
  $root = $this->webroot();
  $site = "$root/sites/$env";


  // Validate
  if (substr($version_string, 0, 1) == 6 && $this->db_driver(UNISH_DB_URL) == 'sqlite') {
    $this->markTestSkipped("Drupal 6 does not support SQLite.");
  }

  // Download Drupal if not already present.
  if (!file_exists($root)) {
    $options = array(
      'destination' => UNISH_SANDBOX,
      'drupal-project-rename' => 'web',
      'yes' => NULL,
      'quiet' => NULL,
      'cache' => NULL,
    );
    $this->drush('pm-download', array("drupal-$version_string"), $options);
    // @todo This path is not proper in D8.
    mkdir(UNISH_SANDBOX . '/web/sites/all/drush', 0777, 1);
  }

  // If specified, install Drupal as a multi-site.
  if ($install) {
    $options = array(
      'root' => $root,
      'db-url' => $this->db_url($env),
      'sites-subdir' => $env,
      'yes' => NULL,
      'quiet' => NULL,
    );
    $this->drush('site-install', array($profile), $options);
    // Give us our write perms back.
    chmod($site, 0777);
  }
  else {
    mkdir($site);
    touch("$site/settings.php");
  }
}