17
17
18
18
/**
19
19
* @group time-sensitive
20
+ * @group pb
20
21
*/
21
22
class ProgressBarTest extends \PHPUnit_Framework_TestCase
22
23
{
@@ -29,7 +30,7 @@ public function testMultipleStart()
29
30
30
31
rewind ($ output ->getStream ());
31
32
$ this ->assertEquals (
32
- $ this -> generateOutput ( ' 0 [>---------------------------] ' ) .
33
+ ' 0 [>---------------------------] ' .
33
34
$ this ->generateOutput (' 1 [->--------------------------] ' ).
34
35
$ this ->generateOutput (' 0 [>---------------------------] ' ),
35
36
stream_get_contents ($ output ->getStream ())
@@ -44,7 +45,7 @@ public function testAdvance()
44
45
45
46
rewind ($ output ->getStream ());
46
47
$ this ->assertEquals (
47
- $ this -> generateOutput ( ' 0 [>---------------------------] ' ) .
48
+ ' 0 [>---------------------------] ' .
48
49
$ this ->generateOutput (' 1 [->--------------------------] ' ),
49
50
stream_get_contents ($ output ->getStream ())
50
51
);
@@ -58,7 +59,7 @@ public function testAdvanceWithStep()
58
59
59
60
rewind ($ output ->getStream ());
60
61
$ this ->assertEquals (
61
- $ this -> generateOutput ( ' 0 [>---------------------------] ' ) .
62
+ ' 0 [>---------------------------] ' .
62
63
$ this ->generateOutput (' 5 [----->----------------------] ' ),
63
64
stream_get_contents ($ output ->getStream ())
64
65
);
@@ -73,7 +74,7 @@ public function testAdvanceMultipleTimes()
73
74
74
75
rewind ($ output ->getStream ());
75
76
$ this ->assertEquals (
76
- $ this -> generateOutput ( ' 0 [>---------------------------] ' ) .
77
+ ' 0 [>---------------------------] ' .
77
78
$ this ->generateOutput (' 3 [--->------------------------] ' ).
78
79
$ this ->generateOutput (' 5 [----->----------------------] ' ),
79
80
stream_get_contents ($ output ->getStream ())
@@ -89,7 +90,7 @@ public function testAdvanceOverMax()
89
90
90
91
rewind ($ output ->getStream ());
91
92
$ this ->assertEquals (
92
- $ this -> generateOutput ( ' 9/10 [=========================>--] 90% ' ) .
93
+ ' 9/10 [=========================>--] 90% ' .
93
94
$ this ->generateOutput (' 10/10 [============================] 100% ' ).
94
95
$ this ->generateOutput (' 11/11 [============================] 100% ' ),
95
96
stream_get_contents ($ output ->getStream ())
@@ -99,7 +100,7 @@ public function testAdvanceOverMax()
99
100
public function testFormat ()
100
101
{
101
102
$ expected =
102
- $ this -> generateOutput ( ' 0/10 [>---------------------------] 0% ' ) .
103
+ ' 0/10 [>---------------------------] 0% ' .
103
104
$ this ->generateOutput (' 10/10 [============================] 100% ' ).
104
105
$ this ->generateOutput (' 10/10 [============================] 100% ' )
105
106
;
@@ -156,7 +157,7 @@ public function testCustomizations()
156
157
157
158
rewind ($ output ->getStream ());
158
159
$ this ->assertEquals (
159
- $ this -> generateOutput ( ' 0/10 [/ ] 0% ' ) .
160
+ ' 0/10 [/ ] 0% ' .
160
161
$ this ->generateOutput (' 1/10 [_/ ] 10% ' ),
161
162
stream_get_contents ($ output ->getStream ())
162
163
);
@@ -169,7 +170,7 @@ public function testDisplayWithoutStart()
169
170
170
171
rewind ($ output ->getStream ());
171
172
$ this ->assertEquals (
172
- $ this -> generateOutput ( ' 0/50 [>---------------------------] 0% ' ) ,
173
+ ' 0/50 [>---------------------------] 0% ' ,
173
174
stream_get_contents ($ output ->getStream ())
174
175
);
175
176
}
@@ -193,7 +194,7 @@ public function testFinishWithoutStart()
193
194
194
195
rewind ($ output ->getStream ());
195
196
$ this ->assertEquals (
196
- $ this -> generateOutput ( ' 50/50 [============================] 100% ' ) ,
197
+ ' 50/50 [============================] 100% ' ,
197
198
stream_get_contents ($ output ->getStream ())
198
199
);
199
200
}
@@ -208,7 +209,7 @@ public function testPercent()
208
209
209
210
rewind ($ output ->getStream ());
210
211
$ this ->assertEquals (
211
- $ this -> generateOutput ( ' 0/50 [>---------------------------] 0% ' ) .
212
+ ' 0/50 [>---------------------------] 0% ' .
212
213
$ this ->generateOutput (' 0/50 [>---------------------------] 0% ' ).
213
214
$ this ->generateOutput (' 1/50 [>---------------------------] 2% ' ).
214
215
$ this ->generateOutput (' 2/50 [=>--------------------------] 4% ' ),
@@ -230,7 +231,7 @@ public function testOverwriteWithShorterLine()
230
231
231
232
rewind ($ output ->getStream ());
232
233
$ this ->assertEquals (
233
- $ this -> generateOutput ( ' 0/50 [>---------------------------] 0% ' ) .
234
+ ' 0/50 [>---------------------------] 0% ' .
234
235
$ this ->generateOutput (' 0/50 [>---------------------------] 0% ' ).
235
236
$ this ->generateOutput (' 1/50 [>---------------------------] 2% ' ).
236
237
$ this ->generateOutput (' 2/50 [=>--------------------------] ' ),
@@ -247,7 +248,7 @@ public function testStartWithMax()
247
248
248
249
rewind ($ output ->getStream ());
249
250
$ this ->assertEquals (
250
- $ this -> generateOutput ( ' 0/50 [>---------------------------] ' ) .
251
+ ' 0/50 [>---------------------------] ' .
251
252
$ this ->generateOutput (' 1/50 [>---------------------------] ' ),
252
253
stream_get_contents ($ output ->getStream ())
253
254
);
@@ -264,7 +265,7 @@ public function testSetCurrentProgress()
264
265
265
266
rewind ($ output ->getStream ());
266
267
$ this ->assertEquals (
267
- $ this -> generateOutput ( ' 0/50 [>---------------------------] 0% ' ) .
268
+ ' 0/50 [>---------------------------] 0% ' .
268
269
$ this ->generateOutput (' 0/50 [>---------------------------] 0% ' ).
269
270
$ this ->generateOutput (' 1/50 [>---------------------------] 2% ' ).
270
271
$ this ->generateOutput (' 15/50 [========>-------------------] 30% ' ).
@@ -339,7 +340,7 @@ public function testMultiByteSupport()
339
340
340
341
rewind ($ output ->getStream ());
341
342
$ this ->assertEquals (
342
- $ this -> generateOutput ( ' 0 [>---------------------------] ' ) .
343
+ ' 0 [>---------------------------] ' .
343
344
$ this ->generateOutput (' 3 [■■■>------------------------] ' ),
344
345
stream_get_contents ($ output ->getStream ())
345
346
);
@@ -354,7 +355,7 @@ public function testClear()
354
355
355
356
rewind ($ output ->getStream ());
356
357
$ this ->assertEquals (
357
- $ this -> generateOutput ( ' 0/50 [>---------------------------] 0% ' ) .
358
+ ' 0/50 [>---------------------------] 0% ' .
358
359
$ this ->generateOutput (' 25/50 [==============>-------------] 50% ' ).
359
360
$ this ->generateOutput ('' ),
360
361
stream_get_contents ($ output ->getStream ())
@@ -371,7 +372,7 @@ public function testPercentNotHundredBeforeComplete()
371
372
372
373
rewind ($ output ->getStream ());
373
374
$ this ->assertEquals (
374
- $ this -> generateOutput ( ' 0/200 [>---------------------------] 0% ' ) .
375
+ ' 0/200 [>---------------------------] 0% ' .
375
376
$ this ->generateOutput (' 0/200 [>---------------------------] 0% ' ).
376
377
$ this ->generateOutput (' 199/200 [===========================>] 99% ' ).
377
378
$ this ->generateOutput (' 200/200 [============================] 100% ' ),
@@ -471,9 +472,9 @@ public function testParallelBars()
471
472
472
473
rewind ($ output ->getStream ());
473
474
$ this ->assertEquals (
474
- $ this -> generateOutput ( ' 0/2 [>---------------------------] 0% ' ) ."\n" .
475
- $ this -> generateOutput ( ' 0/3 [#---------------------------] 0% ' ) ."\n" .
476
- rtrim ($ this -> generateOutput ( ' 0 [>---------------------------] ' ) ).
475
+ ' 0/2 [>---------------------------] 0% ' ."\n" .
476
+ ' 0/3 [#---------------------------] 0% ' ."\n" .
477
+ rtrim (' 0 [>---------------------------] ' ).
477
478
478
479
"\033[2A " .
479
480
$ this ->generateOutput (' 1/2 [==============>-------------] 50% ' )."\n" .
@@ -511,7 +512,7 @@ public function testWithoutMax()
511
512
512
513
rewind ($ output ->getStream ());
513
514
$ this ->assertEquals (
514
- rtrim ($ this -> generateOutput ( ' 0 [>---------------------------] ' ) ).
515
+ rtrim (' 0 [>---------------------------] ' ).
515
516
rtrim ($ this ->generateOutput (' 1 [->--------------------------] ' )).
516
517
rtrim ($ this ->generateOutput (' 2 [-->-------------------------] ' )).
517
518
rtrim ($ this ->generateOutput (' 3 [--->------------------------] ' )).
@@ -534,7 +535,7 @@ public function testAddingPlaceholderFormatter()
534
535
535
536
rewind ($ output ->getStream ());
536
537
$ this ->assertEquals (
537
- $ this -> generateOutput ( ' 3 [>---------------------------] ' ) .
538
+ ' 3 [>---------------------------] ' .
538
539
$ this ->generateOutput (' 2 [=========>------------------] ' ).
539
540
$ this ->generateOutput (' 0 [============================] ' ),
540
541
stream_get_contents ($ output ->getStream ())
@@ -553,7 +554,7 @@ public function testMultilineFormat()
553
554
554
555
rewind ($ output ->getStream ());
555
556
$ this ->assertEquals (
556
- $ this -> generateOutput ( ">--------------------------- \nfoobar " ) .
557
+ ">--------------------------- \nfoobar " .
557
558
$ this ->generateOutput ("=========>------------------ \nfoobar " ).
558
559
"\x0D\x1B[2K \x1B[1A \x1B[2K " .
559
560
$ this ->generateOutput ("============================ \nfoobar " ),
@@ -588,11 +589,11 @@ public function testAnsiColorsAndEmojis()
588
589
589
590
rewind ($ output ->getStream ());
590
591
$ this ->assertEquals (
591
- $ this -> generateOutput (
592
+
592
593
" \033[44;37m Starting the demo... fingers crossed \033[0m \n" .
593
594
' 0/15 ' .$ progress .str_repeat ($ empty , 26 )." 0% \n" .
594
595
" \xf0\x9f\x8f\x81 < 1 sec \033[44;37m 0 B \033[0m "
595
- ) .
596
+ .
596
597
$ this ->generateOutput (
597
598
" \033[44;37m Looks good to me... \033[0m \n" .
598
599
' 4/15 ' .str_repeat ($ done , 7 ).$ progress .str_repeat ($ empty , 19 )." 26% \n" .
@@ -614,7 +615,7 @@ public function testSetFormat()
614
615
$ bar ->start ();
615
616
rewind ($ output ->getStream ());
616
617
$ this ->assertEquals (
617
- $ this -> generateOutput ( ' 0 [>---------------------------] ' ) ,
618
+ ' 0 [>---------------------------] ' ,
618
619
stream_get_contents ($ output ->getStream ())
619
620
);
620
621
@@ -623,7 +624,7 @@ public function testSetFormat()
623
624
$ bar ->start ();
624
625
rewind ($ output ->getStream ());
625
626
$ this ->assertEquals (
626
- $ this -> generateOutput ( ' 0/10 [>---------------------------] 0% ' ) ,
627
+ ' 0/10 [>---------------------------] 0% ' ,
627
628
stream_get_contents ($ output ->getStream ())
628
629
);
629
630
}
0 commit comments