Example #1
0
 /**
  * Convert collection to the archive.
  *
  * @return void
  */
 public function execute()
 {
     if ($this->archive->open($this->backup->archivePath(), ZipArchive::CREATE | ZipArchive::OVERWRITE) === true) {
         $this->processCollection();
     }
     $this->archive->close();
     $this->backup->addToRemoval($this->backup->archivePath());
 }
Example #2
0
 /**
  * @test
  */
 public function creates_archive()
 {
     $backup = new Backup($this->dropboxInstance(), $this->working);
     $backup->addJob(new Job(new File($this->terms_file(), $this->assets)));
     $backup->prepare();
     $backup->processFiles();
     $archive = new Archive($backup, new ZipArchive());
     $archive->execute();
     $this->add_file_to_remove($backup->archivePath());
     $this->assertFileExists($backup->archivePath());
 }
Example #3
0
 /**
  * @test
  */
 public function cleans_collection()
 {
     $backup = new Backup($this->dropboxInstance(), $this->working);
     $backup->addJob(new Job(new File($this->terms_file(), $this->assets)));
     $backup->prepare();
     $backup->processFiles();
     $archive = new Archive($backup, new ZipArchive());
     $archive->execute();
     $this->assertCount(1, $backup->getCollection(), 'Collection does not contain 1 item');
     $this->assertFileExists($backup->archivePath());
     $cleanup = new Cleanup($backup);
     $cleanup->execute();
     $this->assertEmpty($backup->getCollection(), 'Collection is not empty');
     $this->assertFileNotExists($backup->archivePath());
 }
Example #4
0
 /**
  * @test
  */
 public function returns_correct_archive_path()
 {
     $backup = new Backup($this->dropboxInstance(), $this->working);
     $backup->setArchiveName('test_archive');
     $this->assertEquals($this->archive_path('test_archive.zip'), $backup->archivePath());
 }