Exemplo n.º 1
0
 /**
  * @test
  *
  * @expectedException \RunOpenCode\Backup\Exception\SourceException
  */
 public function invalidGlob()
 {
     if (defined('HHVM_VERSION')) {
         $this->markTestSkipped();
     }
     // non HHVM
     $source = new GlobSource('/**/*.(txt)');
     $source->fetch();
 }
 /**
  * @test
  */
 public function gzipAndCleanUp()
 {
     $source = new GlobSource(realpath(__DIR__ . '/../Fixtures/glob/globSet1') . '/*');
     $files = $source->fetch();
     $this->assertSame(3, count($files), 'There are 3 files to archive.');
     $processor = new GzipArchiveProcessor('-czvf', 'archive.tar.gz');
     $processor->setEventDispatcher($eventDispatcher = new EventDispatcher());
     $processedFiles = $processor->process($files);
     $this->assertSame(1, count($processedFiles), 'There is one compressed file');
     /**
      * @var FileInterface $processedFile
      */
     $processedFile = $processedFiles[0];
     $this->assertTrue(file_exists($processedFile->getPath()), 'Gzip archive exists.');
     $eventDispatcher->dispatch(BackupEvents::TERMINATE, new BackupEvent());
     $this->assertFalse(file_exists($processedFile->getPath()), 'Gzip archive is cleaned up.');
 }
Exemplo n.º 3
0
 /**
  * @return \RunOpenCode\Backup\Contract\FileInterface[]
  */
 protected function fetchSomeFiles()
 {
     $source = new GlobSource(realpath(__DIR__ . '/../Fixtures/glob/globSet1') . '/*');
     return $source->fetch();
 }