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