Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide optional argument for 'install' to initialize test suites only. #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ The format of this change log follows the advice given at [Keep a CHANGELOG](htt
### Added
- `moodle-plugin-ci install` now provides an option `--no-init` to skip initialization of the Behat and PHPUnit
test suites. Only use this option if execution of these tests are not required.
- `moodle-plugin-ci install` now provides an option `--init-only` to run initialization of the Behat and PHPUnit
test suites only. Can be used if `moodle-plugin-ci install` is called with `--no-init` before. ED: call
`moodle-plugin-ci install --no-init`, apply a patch, call `moodle-plugin-ci install --init-only`.

## [2.1.1] - 2017-09-29
### Fixed
Expand Down
4 changes: 3 additions & 1 deletion src/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ protected function configure()
->addOption('not-paths', null, InputOption::VALUE_REQUIRED, 'CSV of file paths to exclude', $paths)
->addOption('not-names', null, InputOption::VALUE_REQUIRED, 'CSV of file names to exclude', $names)
->addOption('extra-plugins', null, InputOption::VALUE_REQUIRED, 'Directory of extra plugins to install', $extra)
->addOption('no-init', null, InputOption::VALUE_NONE, 'Prevent PHPUnit and Behat initialization');
->addOption('no-init', null, InputOption::VALUE_NONE, 'Prevent PHPUnit and Behat initialization')
->addOption('init-only', null, InputOption::VALUE_NONE, 'Run PHPUnit and Behat initialization only');
}

protected function initialize(InputInterface $input, OutputInterface $output)
Expand Down Expand Up @@ -161,6 +162,7 @@ public function initializeInstallerFactory(InputInterface $input)
$factory->dumper = $this->initializePluginConfigDumper($input);
$factory->pluginsDir = $pluginsDir;
$factory->noInit = $input->getOption('no-init');
$factory->initonly = $input->getOption('init-only');
$factory->database = $resolver->resolveDatabase(
$input->getOption('db-type'),
$input->getOption('db-name'),
Expand Down
11 changes: 11 additions & 0 deletions src/Installer/InstallerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,24 @@ class InstallerFactory
*/
public $noInit;

/**
* @var bool
*/
public $initonly;

/**
* 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)
{
if ($this->initonly && ($this->plugin->hasBehatFeatures() || $this->plugin->hasUnitTests())) {
$installers->add(new TestSuiteInstaller($this->moodle, $this->plugin, $this->execute));

return;
}

$installers->add(new MoodleInstaller($this->execute, $this->database, $this->moodle, new MoodleConfig(), $this->repo, $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));
Expand Down