summaryrefslogtreecommitdiffstats
path: root/phpunit-atleast.patch
blob: 5f2ea0acc94c52a8d3e8125ee53c06df0e730f0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
add --atleast-version command option, backported from 5.0

See https://github.com/sebastianbergmann/phpunit/pull/1876

https://github.com/sebastianbergmann/phpunit/commit/0f335c6908f924042ea3ac9e2c110aa6dce7800e
https://github.com/sebastianbergmann/phpunit/commit/e3b3f36dab3a896f8def75e6ed5789ca40e02872

diff -up ./src/TextUI/Command.php.atleast ./src/TextUI/Command.php
--- ./src/TextUI/Command.php.atleast	2015-09-20 14:56:44.000000000 +0200
+++ ./src/TextUI/Command.php	2015-09-27 11:27:03.043289929 +0200
@@ -34,6 +34,7 @@ class PHPUnit_TextUI_Command
      * @var array
      */
     protected $longOptions = array(
+        'atleast-version='     => null,
         'colors=='             => null,
         'bootstrap='           => null,
         'columns='             => null,
@@ -437,6 +438,13 @@ class PHPUnit_TextUI_Command
                     $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);
@@ -948,6 +956,7 @@ Miscellaneous Options:
 
   -h|--help                 Prints this usage information.
   --version                 Prints the version and exits.
+  --atleast-version <min>   Checks that version is greater than min and exits.
 
 EOT;
 
diff -up ./tests/TextUI/help2.phpt.atleast ./tests/TextUI/help2.phpt
--- ./tests/TextUI/help2.phpt.atleast	2015-09-20 14:56:44.000000000 +0200
+++ ./tests/TextUI/help2.phpt	2015-09-27 11:27:03.043289929 +0200
@@ -86,3 +86,4 @@ Miscellaneous Options:
 
   -h|--help                 Prints this usage information.
   --version                 Prints the version and exits.
+  --atleast-version <min>   Checks that version is greater than min and exits.
diff -up ./tests/TextUI/help.phpt.atleast ./tests/TextUI/help.phpt
--- ./tests/TextUI/help.phpt.atleast	2015-09-20 14:56:44.000000000 +0200
+++ ./tests/TextUI/help.phpt	2015-09-27 11:27:03.043289929 +0200
@@ -85,3 +85,4 @@ Miscellaneous Options:
 
   -h|--help                 Prints this usage information.
   --version                 Prints the version and exits.
+  --atleast-version <min>   Checks that version is greater than min and exits.