public function archiveDumpCase::testArchiveDump

8.0.x archiveDumpTest.php public archiveDumpCase::testArchiveDump()
6.x archiveDumpTest.php public archiveDumpCase::testArchiveDump()
7.x archiveDumpTest.php public archiveDumpCase::testArchiveDump()
4.x archiveDumpTest.php public archiveDumpCase::testArchiveDump()
5.x archiveDumpTest.php public archiveDumpCase::testArchiveDump()
master archiveDumpTest.php public archiveDumpCase::testArchiveDump()

Test if tarball generated by archive-dump looks right.

File

tests/archiveDumpTest.php, line 59

Namespace

Unish

Class

archiveDumpCase
Tests for archive-dump and archive-restore

Code

public function testArchiveDump() {
  $dump_dest = $this->archiveDump(FALSE);
  $docroot = basename($this->webroot());

  // Check the dump file is a gzip file.
  $exec = sprintf('file %s', $dump_dest);
  $this->execute($exec);
  $output = $this->getOutput();
  $expected = '%sgzip compressed data%s';
  $this->assertStringMatchesFormat($expected, $output);

  // Untar the archive and make sure it looks right.
  $untar_dest = $this->unTar($dump_dest);

  if (strpos(UNISH_DB_URL, 'mysql') !== FALSE) {
    $this->execute(sprintf('head %s/unish_%s.sql | grep "MySQL dump"', $untar_dest, self::uri));
  }
  $this->assertFileExists($untar_dest . '/MANIFEST.ini');
  $this->assertFileExists($untar_dest . '/' . $docroot);

  return $dump_dest;
}