/** * Tests the extract Method. * * @group JArchive * @return JArchiveBzip2::extract */ public function testExtractWithStreams() { if (!JArchiveBzip2::isSupported()) { $this->markTestSkipped('Bzip2 files can not be extracted.'); return; } $this->object->extract(__DIR__ . '/logo.bz2', self::$outputPath . '/logo-bz2.png', array('use_streams' => true)); $this->assertTrue(is_file(self::$outputPath . '/logo-bz2.png')); if (is_file(self::$outputPath . '/logo-bz2.png')) { unlink(self::$outputPath . '/logo-bz2.png'); } }
/** * Tests extracting bzip2. * * @return void */ public function testExtractBzip2() { if (!JArchiveBzip2::isSupported()) { $this->markTestSkipped('Bzip2 files can not be extracted.'); } JArchive::extract(__DIR__ . '/logo-bz2.png.bz2', $this->outputPath); $this->assertFileExists($this->outputPath . '/logo-bz2.png'); }
/** * Tests extracting bzip2. * * @return void */ public function testExtractBzip2() { if (!JArchiveBzip2::isSupported()) { $this->markTestSkipped('Bzip2 files can not be extracted.'); } // we need a configuration with a tmp_path set $config = JFactory::$config; $config->set('tmp_path', __DIR__ . '/output'); JArchive::extract(__DIR__ . '/logo-bz2.png.bz2', $this->outputPath); $this->assertFileExists($this->outputPath . '/logo-bz2.png'); }
/** * Tests extracting bzip2. * * @group JArchive * @covers JArchive::extract * @return void */ public function testExtractBzip2() { if (!is_dir(self::$outputPath)) { $this->markTestSkipped("Couldn't create folder."); return; } if (!is_writable(self::$outputPath) || !is_writable(JFactory::getConfig()->get('tmp_path'))) { $this->markTestSkipped("Folder not writable."); return; } if (!JArchiveBzip2::isSupported()) { $this->markTestSkipped('Bzip2 files can not be extracted.'); return; } JArchive::extract(__DIR__ . '/logo.bz2', self::$outputPath . '/logo-bz2.png'); $this->assertTrue(is_file(self::$outputPath . '/logo-bz2.png')); if (is_file(self::$outputPath . '/logo-bz2.png')) { unlink(self::$outputPath . '/logo-bz2.png'); } }
/** * Tests the isSupported Method. * * @group JArchive * @return void * * @covers JArchiveBzip2::isSupported */ public function testIsSupported() { $this->assertEquals( extension_loaded('bz2'), JArchiveBzip2::isSupported() ); }