class archiveDumpCase

  1. 8.0.x tests/archiveDumpTest.php archiveDumpCase
  2. 6.x tests/archiveDumpTest.php archiveDumpCase
  3. 7.x tests/archiveDumpTest.php archiveDumpCase
  4. 4.x tests/archiveDumpTest.php archiveDumpCase
  5. 5.x tests/archiveDumpTest.php archiveDumpCase
  6. master tests/archiveDumpTest.php archiveDumpCase

Hierarchy

Expanded class hierarchy of archiveDumpCase

Members

Contains filters are case sensitive
Name Modifiers Type Descriptionsort descending
archiveDumpCase::testArchiveDump public function
Drush_TestCase::__construct function
Drush_TestCase::is_windows public static function
Drush_TestCase::escapeshellarg public static function
Drush_TestCase::_escapeshellarg_windows public static function
Drush_TestCase::setUpDrupal function
Drush_TestCase::drush_major_version function
Drush_TestCase::create_node_types_php function
Drush_TestCase::file_aliases function
Drush_TestCase::EXIT_SUCCESS constant
Drush_TestCase::EXIT_ERROR constant
Drush_TestCase::getOutput function Accessor for the last output.
Drush_TestCase::getOutputAsList function Accessor for the last output.
Drush_TestCase::execute function Actually runs the command. Does not trap the error stream output as this need PHP 4.3+.
Drush_TestCase::setUpBeforeClass public static function Assure that each class starts with an empty sandbox directory and a clean environment - http://drupal.org/node/1103568.
Drush_TestCase::drush function Invoke drush in via execute().
Drush_TestCase::tearDownAfterClass public static function Runs after each test case. Remove sandbox directory.
Drush_TestCase::file_delete_recursive function Same code as drush_delete_dir().

File

tests/archiveDumpTest.php, line 7

View source
class archiveDumpCase extends Drush_TestCase {

  /*
   * Test dump and extraction.
   */
  public function testArchiveDump() {
    $env = 'testarchivedump';
    $this->setUpDrupal($env, TRUE, '6');
    $root = $this->sites[$env]['root'];
    $docroot = 'web';

    // Create the alias for D7 site.
    $aliases['archivedump'] = array(
      'root' => UNISH_SANDBOX . '/' . $docroot,
      'uri' => $env,
    );
    $contents = $this->file_aliases($aliases);
    $alias_path = "$root/aliases.drushrc.php";
    file_put_contents($alias_path, $contents);

    $name = "example";
    $dump_dest = "dump.tar.gz";
    $options = array(
      'root' => $root,
      'uri' => $env,
      'yes' => NULL,
      'destination' => 'dump.tar.gz',
    );
    $this->drush('archive-dump', array('@archivedump'), $options);
    $exec = sprintf('file %s/%s', UNISH_SANDBOX, $dump_dest);
    $this->execute($exec);
    $output = $this->getOutput();
    $expected = UNISH_SANDBOX . "/dump.tar.gz: gzip compressed data, from Unix";
    $this->assertEquals($expected, $output);

    // Untar it, make sure it looks right.
    $exec = sprintf('tar -xzf %s/%s', UNISH_SANDBOX, $dump_dest);
    $untar_dest = UNISH_SANDBOX . '/untar';
    $exec = sprintf('mkdir %s && cd %s && tar xzf %s/%s', $untar_dest, $untar_dest, UNISH_SANDBOX, $dump_dest);
    $this->execute($exec);
    $this->execute(sprintf('head %s/unish_%s.sql | grep "MySQL dump"', $untar_dest, $env));
    $this->execute('test -f ' . $untar_dest . '/MANIFEST.ini');
    $this->execute('test -d ' . $untar_dest . '/' . $docroot);
  }
}