public function setUp() { // $this->markTestSkipped("Constants already defined problems"); $this->application = new Application(); $this->application->add(new BackupCommand()); $this->execDir = getcwd() . "/vendor/opencart"; $this->installer = new Installer($this->execDir); $this->options = array('db_hostname' => 'localhost', 'db_username' => 'root', 'db_password' => 'root', 'db_database' => 'ocok_opencart_test', 'db_prefix' => 'oc_', 'db_driver' => 'mysqli', 'email' => '*****@*****.**', 'username' => 'admin', 'password' => 'password', 'http_server' => 'http://localhost/opencart/'); $this->installer->install($this->options); }
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); }
public function setUp() { $this->application = new Application(); $this->application->add(new CliTaskCommand()); $dir = getcwd(); $this->execDir = getcwd() . "/vendor/opencart"; $this->installer = new Installer($this->execDir); $this->options = array('db_hostname' => 'localhost', 'db_username' => 'root', 'db_password' => 'root', 'db_database' => 'ocok_opencart_test', 'db_prefix' => 'oc_', 'db_driver' => 'mysqli', 'email' => '*****@*****.**', 'username' => 'admin', 'password' => 'password', 'http_server' => 'http://localhost/opencart/'); $this->installer->install($this->options); $this->fsh = new FileSystem(); $this->oc_controller_dir = $dir . $this->oc_controller_dir; $this->test_controller = $dir . $this->test_controller; if (!is_dir($this->oc_controller_dir)) { mkdir($this->oc_controller_dir); } copy($this->test_controller, $this->oc_controller_dir . $this->controller_file_name); }
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>"); }