public function testExcludeFile() { $this->zipper->add(__DIR__ . '/../../samples'); $this->zipper->exclude(__DIR__ . '/../../samples/files/logs/log.txt'); $this->zipper->setDestination(__DIR__ . '/../../temp/test.zip'); $this->zipper->compress(); $this->assertFileExists(__DIR__ . '/../../temp/test.zip'); $this->extract(); $this->assertFileExists($this->extractDir . '/samples/files/sample.png'); $this->assertFileNotExists($this->extractDir . '/samples/files/logs/log.txt'); }
/** * Saves the files into the extraction directory */ public function extract() { $this->zipper->add($this->dir); $this->extractedFiles[] = $dir = $this->extractionDir . '/' . date("Y-m-d_H-i-s") . '_' . $this->destinationFile; $this->zipper->setDestination($dir); foreach ($this->excludes as $exclude) { $this->zipper->exclude($exclude); } $this->zipper->compress(); }