function Drush_TestCase::setUpDrupal

6.x drush_testcase.inc Drush_TestCase::setUpDrupal($num_sites = 1, $install = FALSE, $version_string = UNISH_DRUPAL_MAJOR_VERSION, $profile = NULL)
4.x drush_testcase.inc Drush_TestCase::setUpDrupal($env = 'dev', $install = FALSE, $version_string = '7.x', $profile = NULL)
5.x drush_testcase.inc Drush_TestCase::setUpDrupal($num_sites = 1, $install = FALSE, $version_string = UNISH_DRUPAL_MAJOR_VERSION, $profile = NULL)
13 calls to Drush_TestCase::setUpDrupal()
archiveDumpCase::testArchiveDump in tests/archiveDumpTest.php
contextCase::setup in tests/contextTest.php
Try to write a tiny drushrc.php to each place that drush checks. Also write a sites/dev/aliases.drushrc.php file to the sandbox.
coreCase::testDrupalDirectory in tests/coreTest.php
EnDisUnListCase::testEnDisUnList in tests/pmEnDisUnListTest.php
fieldCase::testField in tests/fieldTest.php

... See full list

File

tests/drush_testcase.inc, line 160

Class

Drush_TestCase

Code

function setUpDrupal($env = 'dev', $install = FALSE, $version_string = '7.x', $profile = NULL) {
  $root = UNISH_SANDBOX . '/web';
  $this->sites[$env]['root'] = $root;
  $site = "$root/sites/$env";
  if (is_null($profile)) {
    $profile = substr($version_string, 0, 1) >= 7 ? 'testing' : 'default';
  }

  // Download Drupal if not already present.
  if (!file_exists($root)) {
    $options = array(
      'destination' => UNISH_SANDBOX,
      'drupal-project-rename' => 'web',
      'yes' => NULL,
      'quiet' => NULL,
    );
    $this->drush('pm-download', array("drupal-$version_string"), $options);
  }

  // If specified, install Drupal as a multi-site.
  if ($install) {
    $options = array(
      'root' => $root,
      'db-url' => UNISH_DB_URL . '/unish_' . $env,
      'sites-subdir' => $env,
      'yes' => NULL,
      'quiet' => NULL,
    );
    $this->drush('site-install', array($profile), $options);
    // Give us our write perms back.
    $ret = chmod($site, 0777);

    // Stash the db_url for this site.
    $this->sites[$env]['db_url'] = UNISH_DB_URL . '/unish_' . $env;
  }
  else {
    if (!is_dir($site)) {
      mkdir($site);
    }
    touch("$site/settings.php");
  }
  // Make an alias for the site
  $alias_definition = array($env => array(
    'root' => $root,
    'uri' => $env,
  ));
  file_put_contents(UNISH_SANDBOX . '/etc/drush/' . $env . '.alias.drushrc.php', $this->file_aliases($alias_definition));
}