@@ -187,7 +187,6 @@ public function testFormat()
187
187
{
188
188
$ expected =
189
189
' 0/10 [>---------------------------] 0% ' .
190
- $ this ->generateOutput (' 10/10 [============================] 100% ' ).
191
190
$ this ->generateOutput (' 10/10 [============================] 100% ' )
192
191
;
193
192
@@ -296,7 +295,6 @@ public function testPercent()
296
295
rewind ($ output ->getStream ());
297
296
$ this ->assertEquals (
298
297
' 0/50 [>---------------------------] 0% ' .
299
- $ this ->generateOutput (' 0/50 [>---------------------------] 0% ' ).
300
298
$ this ->generateOutput (' 1/50 [>---------------------------] 2% ' ).
301
299
$ this ->generateOutput (' 2/50 [=>--------------------------] 4% ' ),
302
300
stream_get_contents ($ output ->getStream ())
@@ -318,7 +316,6 @@ public function testOverwriteWithShorterLine()
318
316
rewind ($ output ->getStream ());
319
317
$ this ->assertEquals (
320
318
' 0/50 [>---------------------------] 0% ' .
321
- $ this ->generateOutput (' 0/50 [>---------------------------] 0% ' ).
322
319
$ this ->generateOutput (' 1/50 [>---------------------------] 2% ' ).
323
320
$ this ->generateOutput (' 2/50 [=>--------------------------] ' ),
324
321
stream_get_contents ($ output ->getStream ())
@@ -340,7 +337,6 @@ public function testOverwriteWithSectionOutput()
340
337
rewind ($ output ->getStream ());
341
338
$ this ->assertEquals (
342
339
' 0/50 [>---------------------------] 0% ' .PHP_EOL .
343
- "\x1b[1A \x1b[0J " .' 0/50 [>---------------------------] 0% ' .PHP_EOL .
344
340
"\x1b[1A \x1b[0J " .' 1/50 [>---------------------------] 2% ' .PHP_EOL .
345
341
"\x1b[1A \x1b[0J " .' 2/50 [=>--------------------------] 4% ' .PHP_EOL ,
346
342
stream_get_contents ($ output ->getStream ())
@@ -434,7 +430,6 @@ public function testSetCurrentProgress()
434
430
rewind ($ output ->getStream ());
435
431
$ this ->assertEquals (
436
432
' 0/50 [>---------------------------] 0% ' .
437
- $ this ->generateOutput (' 0/50 [>---------------------------] 0% ' ).
438
433
$ this ->generateOutput (' 1/50 [>---------------------------] 2% ' ).
439
434
$ this ->generateOutput (' 15/50 [========>-------------------] 30% ' ).
440
435
$ this ->generateOutput (' 25/50 [==============>-------------] 50% ' ),
@@ -541,7 +536,6 @@ public function testPercentNotHundredBeforeComplete()
541
536
rewind ($ output ->getStream ());
542
537
$ this ->assertEquals (
543
538
' 0/200 [>---------------------------] 0% ' .
544
- $ this ->generateOutput (' 0/200 [>---------------------------] 0% ' ).
545
539
$ this ->generateOutput (' 199/200 [===========================>] 99% ' ).
546
540
$ this ->generateOutput (' 200/200 [============================] 100% ' ),
547
541
stream_get_contents ($ output ->getStream ())
@@ -888,7 +882,6 @@ public function testIterate(): void
888
882
$ this ->assertEquals (
889
883
' 0/2 [>---------------------------] 0% ' .
890
884
$ this ->generateOutput (' 1/2 [==============>-------------] 50% ' ).
891
- $ this ->generateOutput (' 2/2 [============================] 100% ' ).
892
885
$ this ->generateOutput (' 2/2 [============================] 100% ' ),
893
886
stream_get_contents ($ output ->getStream ())
894
887
);
@@ -996,4 +989,18 @@ public function testPreventRedrawFasterThan()
996
989
stream_get_contents ($ output ->getStream ())
997
990
);
998
991
}
992
+
993
+ public function testNoWriteWhenMessageIsSame () : void
994
+ {
995
+ $ bar = new ProgressBar ($ output = $ this ->getOutputStream (), 2 );
996
+ $ bar ->start ();
997
+ $ bar ->advance ();
998
+ $ bar ->display ();
999
+ rewind ($ output ->getStream ());
1000
+ $ this ->assertEquals (
1001
+ ' 0/2 [>---------------------------] 0% ' .
1002
+ $ this ->generateOutput (' 1/2 [==============>-------------] 50% ' ),
1003
+ stream_get_contents ($ output ->getStream ())
1004
+ );
1005
+ }
999
1006
}
0 commit comments