From 0f335c6908f924042ea3ac9e2c110aa6dce7800e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 27 Sep 2015 07:53:14 +0200 Subject: [PATCH 1/2] add --atleast-version command option --- src/TextUI/Command.php | 9 +++++++++ tests/TextUI/help.phpt | 1 + tests/TextUI/help2.phpt | 1 + 3 files changed, 11 insertions(+) diff --git a/src/TextUI/Command.php b/src/TextUI/Command.php index 1db767baa43..ec795172fb8 100644 --- a/src/TextUI/Command.php +++ b/src/TextUI/Command.php @@ -34,6 +34,7 @@ class PHPUnit_TextUI_Command * @var array */ protected $longOptions = [ + 'atleast-version=' => null, 'bootstrap=' => null, 'colors==' => null, 'columns=' => null, @@ -449,6 +450,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); @@ -953,6 +961,7 @@ protected function showHelp() -h|--help Prints this usage information. --version Prints the version and exits. + --atleast-version min Checks the version is greater than min and exits. EOT; diff --git a/tests/TextUI/help.phpt b/tests/TextUI/help.phpt index 176b056669c..eb8bce2d7aa 100644 --- a/tests/TextUI/help.phpt +++ b/tests/TextUI/help.phpt @@ -90,3 +90,4 @@ Miscellaneous Options: -h|--help Prints this usage information. --version Prints the version and exits. + --atleast-version min Checks the version is greater than min and exits. diff --git a/tests/TextUI/help2.phpt b/tests/TextUI/help2.phpt index 0cb238f443a..dc774e9750f 100644 --- a/tests/TextUI/help2.phpt +++ b/tests/TextUI/help2.phpt @@ -91,3 +91,4 @@ Miscellaneous Options: -h|--help Prints this usage information. --version Prints the version and exits. + --atleast-version min Checks the version is greater than min and exits. From e3b3f36dab3a896f8def75e6ed5789ca40e02872 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sun, 27 Sep 2015 11:37:02 +0300 Subject: [PATCH 2/2] Add ChangeLog entry; tweak help message --- ChangeLog-5.0.md | 1 + src/TextUI/Command.php | 2 +- tests/TextUI/help.phpt | 2 +- tests/TextUI/help2.phpt | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) 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 ec795172fb8..5f5dff500b2 100644 --- a/src/TextUI/Command.php +++ b/src/TextUI/Command.php @@ -961,7 +961,7 @@ protected function showHelp() -h|--help Prints this usage information. --version Prints the version and exits. - --atleast-version min Checks the version is greater than min 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 eb8bce2d7aa..294e2d09188 100644 --- a/tests/TextUI/help.phpt +++ b/tests/TextUI/help.phpt @@ -90,4 +90,4 @@ Miscellaneous Options: -h|--help Prints this usage information. --version Prints the version and exits. - --atleast-version min Checks the version is greater than min 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 dc774e9750f..43449a513c0 100644 --- a/tests/TextUI/help2.phpt +++ b/tests/TextUI/help2.phpt @@ -91,4 +91,4 @@ Miscellaneous Options: -h|--help Prints this usage information. --version Prints the version and exits. - --atleast-version min Checks the version is greater than min and exits. + --atleast-version Checks that version is greater than min and exits.