protected $archiverPluginId = 'Zip';
/**
* Tests that the Zip archive is created if it does not exist.
*/
public function testCreateArchive() { $textFile =
current($this->
getTestFiles('text'
));
$archiveFilename =
$this->fileSystem->
realpath('public://' .
$this->
randomMachineName() . '.zip'
);
$zip =
new Zip($archiveFilename,
[ 'flags' => \ZipArchive::CREATE,
]);
$zip->
add($this->fileSystem->
realPath($textFile->uri
));
// Close the archive and make sure it is written to disk.
$this->
assertTrue($zip->
getArchive()->
close(), 'Successfully closed archive.'
);
$this->
assertFileExists($archiveFilename, 'Archive is automatically created if the file does not exist.'
);
$this->
assertArchiveContainsFile($archiveFilename,
$this->fileSystem->
realPath($textFile->uri
));
} /**
* Tests that the Zip archiver is created and overwritten.
*/
public function testOverwriteArchive() { // Create an archive similarly to how it's done in ::testCreateArchive.