@@ -27,40 +27,62 @@ final class PrepareForOutputTest extends TestCase
2727 * @param string $content The content to prepare.
2828 * @param string[] $exclude A list of characters to leave invisible.
2929 * @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).
3131 *
3232 * @requires OS ^(?!WIN).*
3333 * @dataProvider dataPrepareForOutput
3434 *
3535 * @return void
3636 */
37- public function testPrepareForOutput ($ content , $ exclude , $ expected , $ expectedWin )
37+ public function testPrepareForOutput ($ content , $ exclude , $ expected , $ expectedOld )
3838 {
3939 $ this ->assertSame ($ expected , Common::prepareForOutput ($ content , $ exclude ));
4040
4141 }//end testPrepareForOutput()
4242
4343
4444 /**
45- * Test formatting whitespace characters, on Windows.
45+ * Test formatting whitespace characters, on modern PHP on Windows.
4646 *
4747 * @param string $content The content to prepare.
4848 * @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) .
5151 *
5252 * @requires OS ^WIN.*.
53+ * @requires PHP >= 7.1
5354 * @dataProvider dataPrepareForOutput
5455 *
5556 * @return void
5657 */
57- public function testPrepareForOutputWindows ($ content , $ exclude , $ expected , $ expectedWin )
58+ public function testPrepareForOutputWindows ($ content , $ exclude , $ expected , $ expectedOld )
5859 {
59- $ this ->assertSame ($ expectedWin , Common::prepareForOutput ($ content , $ exclude ));
60+ $ this ->assertSame ($ expected , Common::prepareForOutput ($ content , $ exclude ));
6061
6162 }//end testPrepareForOutputWindows()
6263
6364
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+
6486 /**
6587 * Data provider.
6688 *
@@ -76,25 +98,25 @@ public static function dataPrepareForOutput()
7698 'content ' => "\r\n\t" ,
7799 'exclude ' => [],
78100 'expected ' => "\033[30;1m \\r \\n \\t \033[0m " ,
79- 'expectedWin ' => "\033[30;1m \\r \\n \\t \033[0m " ,
101+ 'expectedOld ' => "\033[30;1m \\r \\n \\t \033[0m " ,
80102 ],
81103 'Spaces are replaced with a unique mark ' => [
82104 'content ' => " " ,
83105 'exclude ' => [],
84106 'expected ' => "\033[30;1m···· \033[0m " ,
85- 'expectedWin ' => " " ,
107+ 'expectedOld ' => " " ,
86108 ],
87109 'Other characters are unaffected ' => [
88110 'content ' => "{echo 1;} " ,
89111 'exclude ' => [],
90112 'expected ' => "{echo \033[30;1m· \033[0m1;} " ,
91- 'expectedWin ' => "{echo 1;} " ,
113+ 'expectedOld ' => "{echo 1;} " ,
92114 ],
93115 'No replacements ' => [
94116 'content ' => 'nothing-should-be-replaced ' ,
95117 'exclude ' => [],
96118 'expected ' => 'nothing-should-be-replaced ' ,
97- 'expectedWin ' => 'nothing-should-be-replaced ' ,
119+ 'expectedOld ' => 'nothing-should-be-replaced ' ,
98120 ],
99121 'Excluded whitespace characters are unaffected ' => [
100122 'content ' => "\r\n\t " ,
@@ -103,7 +125,7 @@ public static function dataPrepareForOutput()
103125 "\n" ,
104126 ],
105127 'expected ' => "\r\n\033[30;1m \\t· \033[0m " ,
106- 'expectedWin ' => "\r\n\033[30;1m \\t \033[0m " ,
128+ 'expectedOld ' => "\r\n\033[30;1m \\t \033[0m " ,
107129 ],
108130 ];
109131
0 commit comments