Example #1
0
 /**
  * Tests the extract Method.
  *
  * @group   JArchive
  * @return  void
  *
  * @covers  Joomla\Archive\Gzip::extract
  * @covers  Joomla\Archive\Gzip::getFilePosition
  */
 public function testExtractWithStreams()
 {
     if (!ArchiveGzip::isSupported()) {
         $this->markTestSkipped('Gzip files can not be extracted.');
         return;
     }
     try {
         $this->object->extract(__DIR__ . '/logo.gz', self::$outputPath . '/logo-gz.png', array('use_streams' => true));
     } catch (\RuntimeException $e) {
         $this->assertTrue(is_file(self::$outputPath . '/logo-gz.png'));
     }
     $this->assertTrue(is_file(self::$outputPath . '/logo-gz.png'));
     if (is_file(self::$outputPath . '/logo-gz.png')) {
         unlink(self::$outputPath . '/logo-gz.png');
     }
 }
 /**
  * Tests extracting gzip.
  *
  * @return  void
  *
  * @covers  Joomla\Archive\Archive::extract
  * @since   1.0
  */
 public function testExtractGzip()
 {
     if (!is_dir($this->outputPath)) {
         $this->markTestSkipped("Couldn't create folder.");
         return;
     }
     if (!is_writable($this->outputPath) || !is_writable($this->fixture->options['tmp_path'])) {
         $this->markTestSkipped("Folder not writable.");
         return;
     }
     if (!ArchiveGzip::isSupported()) {
         $this->markTestSkipped('Gzip files can not be extracted.');
         return;
     }
     $this->fixture->extract(__DIR__ . '/logo.gz', $this->outputPath . '/logo-gz.png');
     $this->assertTrue(is_file($this->outputPath . '/logo-gz.png'));
     if (is_file($this->outputPath . '/logo-gz.png')) {
         unlink($this->outputPath . '/logo-gz.png');
     }
 }
Example #3
0
 /**
  * Tests the isSupported Method.
  *
  * @group   JArchive
  * @return  void
  *
  * @covers  Joomla\Archive\Gzip::isSupported
  */
 public function testIsSupported()
 {
     $this->assertEquals(extension_loaded('zlib'), ArchiveGzip::isSupported());
 }