public function testOptions() { $resolver = new DatabaseResolver(); $name = 'TestName'; $user = '******'; $pass = '******'; $host = 'TestHost'; $database = $resolver->resolveDatabase('mysqli', $name, $user, $pass, $host); $this->assertInstanceOf('Moodlerooms\\MoodlePluginCI\\Installer\\Database\\MySQLDatabase', $database); $this->assertEquals($name, $database->name); $this->assertEquals($user, $database->user); $this->assertEquals($pass, $database->pass); $this->assertEquals($host, $database->host); }
/** * Create a new installer factory from input options. * * @param InputInterface $input * * @return InstallerFactory */ public function initializeInstallerFactory(InputInterface $input) { $validate = new Validate(); $resolver = new DatabaseResolver(); $pluginDir = realpath($validate->directory($input->getOption('plugin'))); $pluginsDir = $input->getOption('extra-plugins'); if (!empty($pluginsDir)) { $pluginsDir = realpath($validate->directory($pluginsDir)); } $dumper = new ConfigDumper(); $dumper->addSection('filter', 'notPaths', $this->csvToArray($input->getOption('not-paths'))); $dumper->addSection('filter', 'notNames', $this->csvToArray($input->getOption('not-names'))); $factory = new InstallerFactory(); $factory->moodle = new Moodle($input->getOption('moodle')); $factory->plugin = new MoodlePlugin($pluginDir); $factory->execute = $this->execute; $factory->branch = $validate->moodleBranch($input->getOption('branch')); $factory->dataDir = $input->getOption('data'); $factory->dumper = $dumper; $factory->pluginsDir = $pluginsDir; $factory->database = $resolver->resolveDatabase($input->getOption('db-type'), $input->getOption('db-name'), $input->getOption('db-user'), $input->getOption('db-pass'), $input->getOption('db-host')); return $factory; }