diff --git a/ChangeLog-5.0.md b/ChangeLog-5.0.md index 592022cdcea..cb19f9918e7 100644 --- a/ChangeLog-5.0.md +++ b/ChangeLog-5.0.md @@ -9,6 +9,7 @@ All notable changes of the PHPUnit 5.0 release series are documented in this fil * Implemented [#1604](https://github.com/sebastianbergmann/phpunit/issues/1604): A `@small` test should be marked as risky when it executes code that performs I/O operations * Implemented [#1656](https://github.com/sebastianbergmann/phpunit/issues/1656): Allow sorting test failures in reverse * Merged [#1753](https://github.com/sebastianbergmann/phpunit/issues/1753): Added the `assertFinite()`, `assertInfinite()` and `assertNan()` assertions +* Merged [#1876](https://github.com/sebastianbergmann/phpunit/issues/1876): Added the `--atleast-version` commandline option * Implemented [#1780](https://github.com/sebastianbergmann/phpunit/issues/1780): Support for deep-cloning of results passed between tests using `@depends` * Implemented [#1821](https://github.com/sebastianbergmann/phpunit/issues/1821): Expectations on mock objects passed via `@depends` are now also evaluated for the depending test * Added `--whitelist` commandline option to configure a whitelist for code coverage analysis diff --git a/src/TextUI/Command.php b/src/TextUI/Command.php index 7919263ed54..b27c0c1fd24 100644 --- a/src/TextUI/Command.php +++ b/src/TextUI/Command.php @@ -36,6 +36,7 @@ class PHPUnit_TextUI_Command * @var array */ protected $longOptions = [ + 'atleast-version=' => null, 'bootstrap=' => null, 'colors==' => null, 'columns=' => null, @@ -456,6 +457,13 @@ protected function handleArguments(array $argv) $this->arguments['verbose'] = true; break; + case '--atleast-version': + exit (version_compare(PHPUnit_Runner_Version::id(), $option[1], '>=') + ? PHPUnit_TextUI_TestRunner::SUCCESS_EXIT + : PHPUnit_TextUI_TestRunner::FAILURE_EXIT + ); + break; + case '--version': $this->printVersionString(); exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT); @@ -956,6 +964,7 @@ protected function showHelp() -h|--help Prints this usage information. --version Prints the version and exits. + --atleast-version Checks that version is greater than min and exits. EOT; diff --git a/tests/TextUI/help.phpt b/tests/TextUI/help.phpt index 9b9216f90a5..b8b4b976b4c 100644 --- a/tests/TextUI/help.phpt +++ b/tests/TextUI/help.phpt @@ -91,3 +91,4 @@ Miscellaneous Options: -h|--help Prints this usage information. --version Prints the version and exits. + --atleast-version Checks that version is greater than min and exits. diff --git a/tests/TextUI/help2.phpt b/tests/TextUI/help2.phpt index 865795a1e3c..7e0c4c64316 100644 --- a/tests/TextUI/help2.phpt +++ b/tests/TextUI/help2.phpt @@ -92,3 +92,4 @@ Miscellaneous Options: -h|--help Prints this usage information. --version Prints the version and exits. + --atleast-version Checks that version is greater than min and exits.