/**
  * Given a big bag of install options, add installers to the collection.
  *
  * @param InstallerCollection $installers Installers will be added to this
  */
 public function addInstallers(InstallerCollection $installers)
 {
     $installers->add(new MoodleInstaller($this->execute, $this->database, $this->moodle, new MoodleConfig(), $this->branch, $this->dataDir));
     $installers->add(new PluginInstaller($this->moodle, $this->plugin, $this->pluginsDir, $this->dumper));
     $installers->add(new VendorInstaller($this->moodle, $this->plugin, $this->execute));
     if ($this->plugin->hasBehatFeatures() || $this->plugin->hasUnitTests()) {
         $installers->add(new TestSuiteInstaller($this->moodle, $this->plugin, $this->execute));
     }
 }
 public function install()
 {
     $this->getOutput()->step('Install dependencies');
     $processes = [];
     if ($this->plugin->hasUnitTests() || $this->plugin->hasBehatFeatures()) {
         $processes[] = new Process('composer install --no-interaction --prefer-dist', $this->moodle->directory, null, null, null);
     }
     $processes[] = new Process('npm install -g jshint csslint shifter@0.4.6', null, null, null, null);
     $this->execute->mustRunAll($processes);
 }
 public function testNoBehatFeatures()
 {
     // Remove the only unit test file.
     $fs = new Filesystem();
     $fs->remove($this->pluginDir . '/tests/behat/login.feature');
     $plugin = new MoodlePlugin($this->pluginDir);
     $this->assertFalse($plugin->hasBehatFeatures());
 }
 /**
  * Get all the post install processes.
  *
  * @return Process[]
  */
 public function getPostInstallProcesses()
 {
     $processes = [];
     if ($this->plugin->hasBehatFeatures()) {
         $this->getOutput()->debug('Enabling Behat');
         $binDir = realpath(__DIR__ . '/../../bin');
         $processes[] = new Process(sprintf('%s/start-selenium %s', $binDir, $this->getSeleniumJarPath()));
         $processes[] = new Process(sprintf('%s/start-web-server', $binDir), $this->moodle->directory);
         $processes[] = new MoodleProcess(sprintf('%s --enable', $this->getBehatUtility()));
     }
     if ($this->plugin->hasUnitTests()) {
         $this->getOutput()->debug('Build PHPUnit config');
         $processes[] = new MoodleProcess(sprintf('%s/admin/tool/phpunit/cli/util.php --buildconfig', $this->moodle->directory));
     }
     return $processes;
 }