コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
 /**
  * @param string $branch
  *
  * @dataProvider invalidMoodleBranchProvider
  * @expectedException \InvalidArgumentException
  */
 public function testMoodleBranchInvalid($branch)
 {
     $validate = new Validate();
     $this->assertEquals($branch, $validate->moodleBranch($branch), "Validate that {$branch} is NOT valid");
 }