You are here

public function DatabaseSanitizeCase::setUp in Database Sanitize 8

Same name and namespace in other branches
  1. 7 drush/tests/DatabaseSanitizeTest.php \Unish\DatabaseSanitizeCase::setUp()

Setup the environment.

File

drush/tests/DatabaseSanitizeTest.php, line 69

Class

DatabaseSanitizeCase
PHPUnit Tests for Database Sanitize.

Namespace

Unish

Code

public function setUp() {

  // Install the standard install profile.
  $sites = $this
    ->setUpDrupal(1, TRUE, UNISH_DRUPAL_MAJOR_VERSION);
  $this->webRoot = $this
    ->webroot();
  $this->siteOptions = [
    'root' => $this->webRoot,
    'uri' => key($sites),
    'yes' => NULL,
  ];
  $this
    ->setAutoloader();

  // Symlink database_sanitize inside the site being tested, so that it is
  // available as a drush command.
  $target = dirname(__DIR__, 2);
  \symlink($target, $this->webRoot . '/modules/database_sanitize');
  $this
    ->drush('cache-clear', [
    'drush',
  ], $this->siteOptions);
  $this
    ->drush('pm-enable', [
    'database_sanitize',
    'node',
  ], $this->siteOptions);

  // Get tables defined in the database.
  $this
    ->drush('sqlq', [
    'show tables;',
  ], $this->siteOptions);
  $this->dbTables = $this
    ->getOutputAsList();
  $this->fullySpecifiedYmlFile = $this->webRoot . '/database.sanitize.full.yml';
  $this
    ->generateFullySpecifiedYmlFile();
  $this->mergeYmlFile = $this->webRoot . '/modules/database_sanitize/drush/tests/assets/database.sanitize.merge.yml';
}