Index: trunk/phase3/maintenance/term/MWTerm.php |
— | — | @@ -0,0 +1,50 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * @ingroup Testing |
| 6 | + * |
| 7 | + * Set of classes to help with test output and such. Right now pretty specific |
| 8 | + * to the parser tests but could be more useful one day :) |
| 9 | + * |
| 10 | + * @todo Fixme: Make this more generic |
| 11 | + */ |
| 12 | + |
| 13 | +class AnsiTermColorer { |
| 14 | + function __construct() { |
| 15 | + } |
| 16 | + |
| 17 | + /** |
| 18 | + * Return ANSI terminal escape code for changing text attribs/color |
| 19 | + * |
| 20 | + * @param $color String: semicolon-separated list of attribute/color codes |
| 21 | + * @return String |
| 22 | + */ |
| 23 | + public function color( $color ) { |
| 24 | + global $wgCommandLineDarkBg; |
| 25 | + |
| 26 | + $light = $wgCommandLineDarkBg ? "1;" : "0;"; |
| 27 | + |
| 28 | + return "\x1b[{$light}{$color}m"; |
| 29 | + } |
| 30 | + |
| 31 | + /** |
| 32 | + * Return ANSI terminal escape code for restoring default text attributes |
| 33 | + * |
| 34 | + * @return String |
| 35 | + */ |
| 36 | + public function reset() { |
| 37 | + return $this->color( 0 ); |
| 38 | + } |
| 39 | +} |
| 40 | + |
| 41 | +/* A colour-less terminal */ |
| 42 | +class DummyTermColorer { |
| 43 | + public function color( $color ) { |
| 44 | + return ''; |
| 45 | + } |
| 46 | + |
| 47 | + public function reset() { |
| 48 | + return ''; |
| 49 | + } |
| 50 | +} |
| 51 | + |
Property changes on: trunk/phase3/maintenance/term/MWTerm.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
1 | 52 | Merged /branches/phpunit-restructure/maintenance/tests/testHelpers.inc:r72257-72560 |
Added: svn:eol-style |
2 | 53 | + native |
Index: trunk/phase3/tests/testHelpers.inc |
— | — | @@ -1,53 +1,5 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -/** |
5 | | - * @ingroup Testing |
6 | | - * |
7 | | - * Set of classes to help with test output and such. Right now pretty specific |
8 | | - * to the parser tests but could be more useful one day :) |
9 | | - * |
10 | | - * @todo Fixme: Make this more generic |
11 | | - */ |
12 | | - |
13 | | -class AnsiTermColorer { |
14 | | - function __construct() { |
15 | | - } |
16 | | - |
17 | | - /** |
18 | | - * Return ANSI terminal escape code for changing text attribs/color |
19 | | - * |
20 | | - * @param $color String: semicolon-separated list of attribute/color codes |
21 | | - * @return String |
22 | | - */ |
23 | | - public function color( $color ) { |
24 | | - global $wgCommandLineDarkBg; |
25 | | - |
26 | | - $light = $wgCommandLineDarkBg ? "1;" : "0;"; |
27 | | - |
28 | | - return "\x1b[{$light}{$color}m"; |
29 | | - } |
30 | | - |
31 | | - /** |
32 | | - * Return ANSI terminal escape code for restoring default text attributes |
33 | | - * |
34 | | - * @return String |
35 | | - */ |
36 | | - public function reset() { |
37 | | - return $this->color( 0 ); |
38 | | - } |
39 | | -} |
40 | | - |
41 | | -/* A colour-less terminal */ |
42 | | -class DummyTermColorer { |
43 | | - public function color( $color ) { |
44 | | - return ''; |
45 | | - } |
46 | | - |
47 | | - public function reset() { |
48 | | - return ''; |
49 | | - } |
50 | | -} |
51 | | - |
52 | 4 | class TestRecorder { |
53 | 5 | var $parent; |
54 | 6 | var $term; |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -885,11 +885,13 @@ |
886 | 886 | 'textStatsOutput' => 'maintenance/language/StatOutputs.php', |
887 | 887 | 'wikiStatsOutput' => 'maintenance/language/StatOutputs.php', |
888 | 888 | |
| 889 | + # maintenance/term |
| 890 | + 'AnsiTermColorer' => 'maintenance/term/MWTerm.php', |
| 891 | + 'DummyTermColorer' => 'maintenance/term/MWTerm.php', |
| 892 | + |
889 | 893 | # tests |
890 | | - 'AnsiTermColorer' => 'tests/testHelpers.inc', |
891 | 894 | 'DbTestPreviewer' => 'tests/testHelpers.inc', |
892 | 895 | 'DbTestRecorder' => 'tests/testHelpers.inc', |
893 | | - 'DummyTermColorer' => 'tests/testHelpers.inc', |
894 | 896 | 'TestFileIterator' => 'tests/testHelpers.inc', |
895 | 897 | 'TestRecorder' => 'tests/testHelpers.inc', |
896 | 898 | |