@@ 66-83 (lines=18) @@ | ||
63 | static::assertEquals(1, $result, "File is not compressed as gzip"); |
|
64 | } |
|
65 | ||
66 | public function testFileGetsDecompressedFromGzip() |
|
67 | { |
|
68 | $file = new LocalFile(static::$dir . 'get_decompressed_uncompressed_gz.test'); |
|
69 | $file->put('random stuff and things!'); |
|
70 | ||
71 | $compressedFile = $this->gzip->compress($file); |
|
72 | $uncompressedFile = $this->gzip->decompress($compressedFile); |
|
73 | ||
74 | static::assertNotNull($uncompressedFile); |
|
75 | static::assertInstanceOf(FileNodeInterface::class, $uncompressedFile); |
|
76 | static::assertEquals(static::$dir . 'get_decompressed_uncompressed_gz', $uncompressedFile->getPath()); |
|
77 | static::assertTrue($uncompressedFile->exists()); |
|
78 | static::assertEquals(CompressionFactory::TYPE_NONE, $uncompressedFile->getCompression()); |
|
79 | ||
80 | $cmd = "file {$uncompressedFile->getPath()} | grep " . escapeshellarg('\bgzip\b') . " | wc -l"; |
|
81 | $result = exec($cmd); |
|
82 | static::assertEquals(0, $result, "File should not be compressed"); |
|
83 | } |
|
84 | ||
85 | public function testCallingGzipWithAFileThatDoesNotExistsThrowsAnException() |
|
86 | { |
@@ 74-93 (lines=20) @@ | ||
71 | static::assertEquals(1, $result, "File is not compressed as zip"); |
|
72 | } |
|
73 | ||
74 | public function testFileGetsDecompressedFromZip() |
|
75 | { |
|
76 | $file = new LocalFile(static::$dir . 'get_decompressed_uncompressed_zip.test'); |
|
77 | $file->put('random stuff and things!'); |
|
78 | ||
79 | $compressedFile = $this->zip->compress($file); |
|
80 | ||
81 | static::assertTrue($compressedFile->exists()); |
|
82 | $uncompressedFile = $this->zip->decompress($compressedFile); |
|
83 | ||
84 | static::assertNotNull($uncompressedFile); |
|
85 | static::assertInstanceOf(FileNodeInterface::class, $uncompressedFile); |
|
86 | static::assertEquals(static::$dir . 'get_decompressed_uncompressed_zip', $uncompressedFile->getPath()); |
|
87 | static::assertTrue($uncompressedFile->exists()); |
|
88 | static::assertEquals(CompressionFactory::TYPE_NONE, $uncompressedFile->getCompression()); |
|
89 | ||
90 | $cmd = "file {$uncompressedFile->getPath()} | grep " . escapeshellarg('\bzip\b') . " | wc -l"; |
|
91 | $result = exec($cmd); |
|
92 | static::assertEquals(0, $result, "File should not be compressed"); |
|
93 | } |
|
94 | ||
95 | public function testCallingZipWithAFileThatDoesNotExistsThrowsAnException() |
|
96 | { |