public function tearDown() { if (is_dir($this->oc_controller_dir)) { $this->fsh->rmdir($this->oc_controller_dir); } $this->installer->removeDatabase($this->options); $this->installer->removeConfigFiles(); }
public function testInstallingOpenCart() { $options = $this->options; $output = $this->installer->install($options); $this->assertEquals("SUCCESS! Opencart successfully installed on your server", $output[0]); $this->assertEquals("Store link: " . $options['http_server'], $output[1]); $this->assertEquals("Admin link: " . $options['http_server'] . "admin/", $output[2]); $this->assertTrue(file_exists($this->oc_dir . DIRECTORY_SEPARATOR . "config.php")); $this->assertTrue(file_exists($this->oc_dir . DIRECTORY_SEPARATOR . "admin" . DIRECTORY_SEPARATOR . "config.php")); $this->installer->removeConfigFiles($options); $this->assertFalse(file_exists($this->oc_dir . DIRECTORY_SEPARATOR . "config.php")); $this->assertFalse(file_exists($this->oc_dir . DIRECTORY_SEPARATOR . "admin" . DIRECTORY_SEPARATOR . "config.php")); $this->installer->removeDatabase($options); }
protected function execute(InputInterface $input, OutputInterface $output) { $fsh = new FileSystem(); $dir = getcwd(); $installer = new Installer($dir . DIRECTORY_SEPARATOR); $options = array(); $options['db_driver'] = $input->getOption("db_driver"); $options['db_hostname'] = $input->getOption("db_hostname"); $options['db_username'] = $input->getOption("db_username"); $options['db_password'] = $input->getOption("db_password"); $options['db_database'] = $input->getOption("db_database"); $options['db_prefix'] = $input->getOption("db_prefix"); $options['username'] = $input->getOption("username"); $options['password'] = $input->getOption("password"); $options['email'] = $input->getOption("email"); $options['http_server'] = $input->getOption("http_server"); if (!$options['db_username']) { $output->writeln("<error>Database Username option is missing!</error>"); return; } if (!$options['db_password']) { $output->writeln("<error>Database Password option is missing!</error>"); return; } if (!$options['username']) { $output->writeln("<error>Username option is missing!</error>"); return; } if (!$options['password']) { $output->writeln("<error>Password option is missing!</error>"); return; } if (!$options['email']) { $output->writeln("<error>Email option is missing!</error>"); return; } if ($fsh->isEmptyDirectory($dir)) { $version = "2.0.1.1"; if ($input->getOption("version")) { $version = $input->getOption("version"); } $downloader = new Downloader($dir); $downloader->process($version); $output->writeln("<info>OpenCart Version {$version} downloaded.</info>"); } else { if ($this->checkUninstalledOC()) { // OC present $version = $this->getVersion(); $output->writeln("<info>OpenCart Version {$version} found.</info>"); } else { $output->writeln("<error>No Empty and no OC Directory found here</error>"); return; } } try { $installer->install($options); $installer->removeInstallationFiles(); } catch (\Exception $e) { $output->writeln("<error>Error: " . $e->getMessage() . "</error>"); return; } $output->writeln("<info>OpenCart was successfully installed!</info>"); }
public function tearDown() { $this->installer->removeDatabase($this->options); $this->installer->removeConfigFiles(); }