function UnishTestCase::fetchInstallDrupal

8.0.x UnishTestCase.php UnishTestCase::fetchInstallDrupal($env = 'dev', $install = FALSE, $version_string = UNISH_DRUPAL_MAJOR_VERSION, $profile = NULL, $separate_roots = FALSE)
7.x UnishTestCase.php UnishTestCase::fetchInstallDrupal($env = 'dev', $install = FALSE, $version_string = UNISH_DRUPAL_MAJOR_VERSION, $profile = NULL, $separate_roots = FALSE)
master UnishTestCase.php UnishTestCase::fetchInstallDrupal($env = 'dev', $install = FALSE, $version_string = UNISH_DRUPAL_MAJOR_VERSION, $profile = NULL, $separate_roots = FALSE)
2 calls to UnishTestCase::fetchInstallDrupal()
archiveDumpCase::archiveDump in tests/archiveDumpTest.php
Install a site and dump it to an archive.
UnishTestCase::setUpDrupal in tests/Unish/UnishTestCase.php

File

tests/Unish/UnishTestCase.php, line 318

Namespace

Unish

Class

UnishTestCase

Code

function fetchInstallDrupal($env = 'dev', $install = FALSE, $version_string = UNISH_DRUPAL_MAJOR_VERSION, $profile = NULL, $separate_roots = FALSE) {
  $root = $this->webroot();
  $uri = $separate_roots ? "default" : "$env";
  $options = array();
  $site = "$root/sites/$uri";

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

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

  // If specified, install Drupal as a multi-site.
  if ($install) {
    $options = array(
      'root' => $root,
      'db-url' => $this->db_url($env),
      'sites-subdir' => $uri,
      '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");
  }
}