Exemplo n.º 1
0
 /**
  * Test backup and extract and check files.
  *
  * @group slow
  */
 public function testBackupAndCheckFiles()
 {
     $this->manager->getEventDispatcher()->addListener(PostBackupEvent::class, function (PostBackupEvent $event) {
         $this->assertNotEmpty($event->getArchiveLocation());
         $zip = new ZipArchive();
         $zip->open($event->getArchiveLocation());
         $this->assertEquals('No error', $zip->getStatusString());
         $dir = $this->tmpDir . 'extracted';
         if (!file_exists($dir)) {
             mkdir($dir);
         }
         $this->assertTrue($zip->extractTo($dir));
         $this->dirHasFile($dir, 'bin');
         $this->dirHasFile($dir, 'res');
         $this->dirHasFile($dir, 'src');
         $this->dirHasFile($dir, 'src/Slicer');
         $this->dirHasFile($dir, 'src/Slicer/Manager/Backup');
         $this->dirHasFile($dir, 'src/Slicer/Command');
         $this->dirHasFile($dir, 'src/Slicer/Command/BackupCommand.php');
         $this->dirHasFile($dir, 'tests');
         $this->dirHasFile($dir, 'vendor');
         $this->dirHasFile($dir, 'composer.json');
         $this->dirHasFile($dir, 'composer.lock');
         $this->dirHasFile($dir, 'LICENSE');
         $this->dirHasFile($dir, 'phpunit.xml.dist');
         $this->dirHasFile($dir, 'slicer.json');
         $this->postVerified = TRUE;
     });
     $this->manager->backup(self::$backupOptions);
     $this->assertTrue($this->postVerified);
 }