Created
February 11, 2014 14:44
-
-
Save chobie/8936124 to your computer and use it in GitHub Desktop.
add ability to specify bootstrap file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/PhpSpec/Console/Command/RunCommand.php b/src/PhpSpec/Console/Command/RunCommand.php | |
index ca4a61e..64319d3 100644 | |
--- a/src/PhpSpec/Console/Command/RunCommand.php | |
+++ b/src/PhpSpec/Console/Command/RunCommand.php | |
@@ -33,6 +33,7 @@ class RunCommand extends Command | |
new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Formatter'), | |
new InputOption('stop-on-failure', null , InputOption::VALUE_NONE, 'Stop on failure'), | |
new InputOption('no-code-generation', null , InputOption::VALUE_NONE, 'Do not prompt for missing method/class generation'), | |
+ new InputOption('bootstrap', "b", InputOption::VALUE_OPTIONAL, 'bootstrap file', "SpecHelper.php"), | |
)) | |
->setDescription('Runs specifications') | |
->setHelp(<<<EOF | |
@@ -83,6 +84,11 @@ EOF | |
protected function execute(InputInterface $input, OutputInterface $output) | |
{ | |
$container = $this->getApplication()->getContainer(); | |
+ $bootstrap_file = getcwd() . DIRECTORY_SEPARATOR . $input->getOption("bootstrap"); | |
+ if (is_file($bootstrap_file)) { | |
+ require $bootstrap_file; | |
+ } | |
+ | |
$container->setParam('formatter.name', | |
$input->getOption('format') ?: $container->getParam('formatter.name') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment