/** * Test setAdapter exception message. * * @return void * * @since 1.0 */ public function testSetAdapterExceptionMessage() { try { $this->fixture->setAdapter('unknown', 'FooArchiveAdapter'); } catch (\InvalidArgumentException $e) { $this->assertEquals('The provided adapter "unknown" (class "FooArchiveAdapter") must implement Joomla\\Archive\\ExtractableInterface', $e->getMessage()); } }
/** * Install a single package (archived file) * * @param $source * @return $this */ protected function installPackageFile($source, $target) { if (!file_exists($source)) { throw new \RuntimeException('Source library folder does not exists!'); } // first unpack to tmp dir, then install the directory $tmpFolder = $this->getTmpDir() . '/' . pathinfo($source, PATHINFO_FILENAME); $this->fs->mkdir($tmpFolder); $archive = new Archive(); $archive->extract($source, $tmpFolder); // install the extension $installer = new Installer($tmpFolder); $installer->getAdapter()->install($target); // cleanup tmp folder $this->fs->remove($tmpFolder); return $this; }