@@ -27,45 +27,68 @@ final class PrepareForOutputTest extends TestCase
27
27
* @param string $content The content to prepare.
28
28
* @param string[] $exclude A list of characters to leave invisible.
29
29
* @param string $expected Expected function output.
30
- * @param string $expectedWin Expected function output on Windows (unused in this test).
30
+ * @param string $expectedOld Expected function output on PHP<7.1 on Windows (unused in this test).
31
31
*
32
32
* @requires OS ^(?!WIN).*
33
33
* @dataProvider dataPrepareForOutput
34
34
*
35
35
* @return void
36
36
*/
37
- public function testPrepareForOutput ($ content , $ exclude , $ expected , $ expectedWin )
37
+ public function testPrepareForOutput ($ content , $ exclude , $ expected , $ expectedOld )
38
38
{
39
39
$ this ->assertSame ($ expected , Common::prepareForOutput ($ content , $ exclude ));
40
40
41
41
}//end testPrepareForOutput()
42
42
43
43
44
44
/**
45
- * Test formatting whitespace characters, on Windows.
45
+ * Test formatting whitespace characters, on modern PHP on Windows.
46
46
*
47
47
* @param string $content The content to prepare.
48
48
* @param string[] $exclude A list of characters to leave invisible.
49
- * @param string $expected Expected function output (unused in this test) .
50
- * @param string $expectedWin Expected function output on Windows.
49
+ * @param string $expected Expected function output.
50
+ * @param string $expectedOld Expected function output on PHP<7.1 on Windows (unused in this test) .
51
51
*
52
52
* @requires OS ^WIN.*.
53
+ * @requires PHP >= 7.1
53
54
* @dataProvider dataPrepareForOutput
54
55
*
55
56
* @return void
56
57
*/
57
- public function testPrepareForOutputWindows ($ content , $ exclude , $ expected , $ expectedWin )
58
+ public function testPrepareForOutputWindows ($ content , $ exclude , $ expected , $ expectedOld )
58
59
{
59
- $ this ->assertSame ($ expectedWin , Common::prepareForOutput ($ content , $ exclude ));
60
+ $ this ->assertSame ($ expected , Common::prepareForOutput ($ content , $ exclude ));
60
61
61
62
}//end testPrepareForOutputWindows()
62
63
63
64
65
+ /**
66
+ * Test formatting whitespace characters, on PHP<7.1 on Windows.
67
+ *
68
+ * @param string $content The content to prepare.
69
+ * @param string[] $exclude A list of characters to leave invisible.
70
+ * @param string $expected Expected function output (unused in this test).
71
+ * @param string $expectedOld Expected function output on PHP<7.1 on Windows.
72
+ *
73
+ * @requires OS ^WIN.*.
74
+ * @requires PHP < 7.1
75
+ * @dataProvider dataPrepareForOutput
76
+ *
77
+ * @return void
78
+ */
79
+ public function testPrepareForOutputOldPHPWindows ($ content , $ exclude , $ expected , $ expectedOld )
80
+ {
81
+ $ this ->assertSame ($ expectedOld , Common::prepareForOutput ($ content , $ exclude ));
82
+
83
+ }//end testPrepareForOutputOldPHPWindows()
84
+
85
+
64
86
/**
65
87
* Data provider.
66
88
*
67
89
* @see testPrepareForOutput()
68
90
* @see testPrepareForOutputWindows()
91
+ * @see testPrepareForOutputOldPHPWindows()
69
92
*
70
93
* @return array<string, array<string, mixed>>
71
94
*/
@@ -76,25 +99,25 @@ public static function dataPrepareForOutput()
76
99
'content ' => "\r\n\t" ,
77
100
'exclude ' => [],
78
101
'expected ' => "\033[30;1m \\r \\n \\t \033[0m " ,
79
- 'expectedWin ' => "\033[30;1m \\r \\n \\t \033[0m " ,
102
+ 'expectedOld ' => "\033[30;1m \\r \\n \\t \033[0m " ,
80
103
],
81
104
'Spaces are replaced with a unique mark ' => [
82
105
'content ' => " " ,
83
106
'exclude ' => [],
84
107
'expected ' => "\033[30;1m···· \033[0m " ,
85
- 'expectedWin ' => " " ,
108
+ 'expectedOld ' => " " ,
86
109
],
87
110
'Other characters are unaffected ' => [
88
111
'content ' => "{echo 1;} " ,
89
112
'exclude ' => [],
90
113
'expected ' => "{echo \033[30;1m· \033[0m1;} " ,
91
- 'expectedWin ' => "{echo 1;} " ,
114
+ 'expectedOld ' => "{echo 1;} " ,
92
115
],
93
116
'No replacements ' => [
94
117
'content ' => 'nothing-should-be-replaced ' ,
95
118
'exclude ' => [],
96
119
'expected ' => 'nothing-should-be-replaced ' ,
97
- 'expectedWin ' => 'nothing-should-be-replaced ' ,
120
+ 'expectedOld ' => 'nothing-should-be-replaced ' ,
98
121
],
99
122
'Excluded whitespace characters are unaffected ' => [
100
123
'content ' => "\r\n\t " ,
@@ -103,7 +126,7 @@ public static function dataPrepareForOutput()
103
126
"\n" ,
104
127
],
105
128
'expected ' => "\r\n\033[30;1m \\t· \033[0m " ,
106
- 'expectedWin ' => "\r\n\033[30;1m \\t \033[0m " ,
129
+ 'expectedOld ' => "\r\n\033[30;1m \\t \033[0m " ,
107
130
],
108
131
];
109
132
0 commit comments