public function testIsTagException() { $this->setExpectedException('InvalidArgumentException'); file_put_contents($this->cacheFile, json_encode(['heads' => ['1.x' => 'test'], 'tags' => ['1.0.0' => 'test']])); $model = new Versions($this->cacheFile); $model->isTag('does not exist'); }
/** * Perform the download and extraction to target directory * * @param OutputInterface $output output object to perform output actions * * @throws \RuntimeException * * @return void */ protected function doDownload(OutputInterface $output) { $release = array_keys($this->version)[0]; $url = array_values($this->version)[0]; $output->writeln('Downloading and extracting release ' . $release); $this->downloadModel->download($url, $release, $this->target, $this->versionsModel->isTag($release)); $output->writeln('Installed Joomla to ' . $this->target); if (!$this->keepInstallationFolder) { $installationFolder = escapeshellarg($this->target . '/installation'); `rm -rf {$installationFolder}`; $output->writeln('Removed installation folder'); } }
/** * Perform the sql statements, also downloads given Joomla version so we can get the install.sql * * @param OutputInterface $output output object to perform output actions * * @throws \RuntimeException * @throws \Exception * * @return void */ protected function doInstallDb(OutputInterface $output) { $release = array_keys($this->version)[0]; $url = array_values($this->version)[0]; $this->downloadModel->download($url, $release, $this->target, $this->versionsModel->isTag($release)); // do sql stuff try { $this->createDatabase(); $this->importDatabase(); $this->createAdminUser(); } catch (\Exception $e) { $this->cleanUp($this->target); throw $e; } $this->cleanUp($this->target); }