Пример #1
0
 public function testDecompressWillThrowExceptionWhenDecompressingWithNoTarget()
 {
     $filter = new ZipCompression(array('archive' => dirname(__DIR__) . '/_files/compressed.zip', 'target' => dirname(__DIR__) . '/_files/_compress'));
     $content = $filter->compress('compress me');
     $this->assertEquals(dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'compressed.zip', $content);
     $filter = new ZipCompression(array('archive' => dirname(__DIR__) . '/_files/compressed.zip', 'target' => dirname(__DIR__) . '/_files/_compress'));
     $content = $filter->decompress($content);
     $this->assertEquals(dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR, $content);
     $content = file_get_contents(dirname(__DIR__) . '/_files/_compress');
     $this->assertEquals('compress me', $content);
 }
Пример #2
0
 /**
  * @group 6026
  *
  * @covers \Zend\Filter\Compress\Zip::decompress
  */
 public function testDecompressWhenNoArchieveInClass()
 {
     if (!constant('TESTS_ZEND_FILTER_COMPRESS_ZIP_ENABLED')) {
         $this->markTestSkipped('ZIP compression tests are currently disabled');
     }
     $filter = new ZipCompression(array('archive' => $this->tmp . '/compressed.zip', 'target' => $this->tmp . '/_compress'));
     $content = $filter->compress('compress me');
     $this->assertEquals($this->tmp . DIRECTORY_SEPARATOR . 'compressed.zip', $content);
     $filter = new ZipCompression(array('target' => $this->tmp . '/_compress'));
     $content = $filter->decompress($content);
     $this->assertEquals($this->tmp . DIRECTORY_SEPARATOR, $content);
     $content = file_get_contents($this->tmp . '/_compress');
     $this->assertEquals('compress me', $content);
 }