diff --git a/src/mako/cli/output/components/progress/traits/ProgressTrait.php b/src/mako/cli/output/components/progress/traits/ProgressTrait.php index ff689784e..cedb6bdea 100644 --- a/src/mako/cli/output/components/progress/traits/ProgressTrait.php +++ b/src/mako/cli/output/components/progress/traits/ProgressTrait.php @@ -10,6 +10,7 @@ use function floor; use function microtime; use function min; +use function number_format; use function str_pad; use function str_repeat; use function strlen; @@ -39,11 +40,13 @@ protected function buildProgressBar(float $percent): string { $fill = (int) floor($percent * $this->width); + $progress = number_format($percent * 100, 2, '.', ''); + return str_pad($this->progress, strlen($this->itemCount), '0', STR_PAD_LEFT) . "/{$this->itemCount} " . str_repeat($this->progressBar->getFilled(), $fill) . str_repeat($this->progressBar->getEmpty(), ($this->width - $fill)) - . str_pad(' ' . ((int) ($percent * 100)) . '% ', 6, ' ', STR_PAD_LEFT); + . str_pad(" {$progress}% ", 9, ' ', STR_PAD_LEFT); } /** diff --git a/tests/unit/cli/output/components/ProgressIteratorTest.php b/tests/unit/cli/output/components/ProgressIteratorTest.php index 870527323..2997b28ae 100644 --- a/tests/unit/cli/output/components/ProgressIteratorTest.php +++ b/tests/unit/cli/output/components/ProgressIteratorTest.php @@ -29,7 +29,7 @@ public function testProgressWithZeroItems(): void $output->shouldReceive('showCursor')->once(); $output->shouldReceive('restoreCursor'); // Destructor - $output->shouldReceive('write')->once()->with("\r0/0 ████████████████████ 100% "); + $output->shouldReceive('write')->once()->with("\r0/0 ████████████████████ 100.00% "); $output->shouldReceive('write')->once()->with(PHP_EOL); $progress = new ProgressIterator($output, []); @@ -51,17 +51,17 @@ public function testProgressWithItems(): void $output->shouldReceive('showCursor')->once(); $output->shouldReceive('restoreCursor'); // Destructor - $output->shouldReceive('write')->once()->with("\r00/10 ──────────────────── 0% "); - $output->shouldReceive('write')->once()->with("\r01/10 ██────────────────── 10% "); - $output->shouldReceive('write')->once()->with("\r02/10 ████──────────────── 20% "); - $output->shouldReceive('write')->once()->with("\r03/10 ██████────────────── 30% "); - $output->shouldReceive('write')->once()->with("\r04/10 ████████──────────── 40% "); - $output->shouldReceive('write')->once()->with("\r05/10 ██████████────────── 50% "); - $output->shouldReceive('write')->once()->with("\r06/10 ████████████──────── 60% "); - $output->shouldReceive('write')->once()->with("\r07/10 ██████████████────── 70% "); - $output->shouldReceive('write')->once()->with("\r08/10 ████████████████──── 80% "); - $output->shouldReceive('write')->once()->with("\r09/10 ██████████████████── 90% "); - $output->shouldReceive('write')->once()->with("\r10/10 ████████████████████ 100% "); + $output->shouldReceive('write')->once()->with("\r00/10 ──────────────────── 0.00% "); + $output->shouldReceive('write')->once()->with("\r01/10 ██────────────────── 10.00% "); + $output->shouldReceive('write')->once()->with("\r02/10 ████──────────────── 20.00% "); + $output->shouldReceive('write')->once()->with("\r03/10 ██████────────────── 30.00% "); + $output->shouldReceive('write')->once()->with("\r04/10 ████████──────────── 40.00% "); + $output->shouldReceive('write')->once()->with("\r05/10 ██████████────────── 50.00% "); + $output->shouldReceive('write')->once()->with("\r06/10 ████████████──────── 60.00% "); + $output->shouldReceive('write')->once()->with("\r07/10 ██████████████────── 70.00% "); + $output->shouldReceive('write')->once()->with("\r08/10 ████████████████──── 80.00% "); + $output->shouldReceive('write')->once()->with("\r09/10 ██████████████████── 90.00% "); + $output->shouldReceive('write')->once()->with("\r10/10 ████████████████████ 100.00% "); $output->shouldReceive('write')->once()->with(PHP_EOL); $progress = new class ($output, range(1, 10)) extends ProgressIterator { @@ -76,6 +76,44 @@ protected function shouldRedraw(): bool } } + /** + * + */ + public function testProgressWithUnevenItems(): void + { + /** @var \Mockery\MockInterface|Output $output */ + $output = Mockery::mock(Output::class); + + $output->shouldReceive('hideCursor')->once(); + $output->shouldReceive('showCursor')->once(); + $output->shouldReceive('restoreCursor'); // Destructor + + $output->shouldReceive('write')->once()->with("\r00/11 ──────────────────── 0.00% "); + $output->shouldReceive('write')->once()->with("\r01/11 █─────────────────── 9.09% "); + $output->shouldReceive('write')->once()->with("\r02/11 ███───────────────── 18.18% "); + $output->shouldReceive('write')->once()->with("\r03/11 █████─────────────── 27.27% "); + $output->shouldReceive('write')->once()->with("\r04/11 ███████───────────── 36.36% "); + $output->shouldReceive('write')->once()->with("\r05/11 █████████─────────── 45.45% "); + $output->shouldReceive('write')->once()->with("\r06/11 ██████████────────── 54.55% "); + $output->shouldReceive('write')->once()->with("\r07/11 ████████████──────── 63.64% "); + $output->shouldReceive('write')->once()->with("\r08/11 ██████████████────── 72.73% "); + $output->shouldReceive('write')->once()->with("\r09/11 ████████████████──── 81.82% "); + $output->shouldReceive('write')->once()->with("\r10/11 ██████████████████── 90.91% "); + $output->shouldReceive('write')->once()->with("\r11/11 ████████████████████ 100.00% "); + $output->shouldReceive('write')->once()->with(PHP_EOL); + + $progress = new class ($output, range(1, 11)) extends ProgressIterator { + protected function shouldRedraw(): bool + { + return ($this->progress % 1) === 0; + } + }; + + foreach ($progress as $_) { + // + } + } + /** * */ @@ -88,17 +126,17 @@ public function testProgressWithCustomWidth(): void $output->shouldReceive('showCursor')->once(); $output->shouldReceive('restoreCursor'); // Destructor - $output->shouldReceive('write')->once()->with("\r00/10 ──────────────────────────────────────── 0% "); - $output->shouldReceive('write')->once()->with("\r01/10 ████──────────────────────────────────── 10% "); - $output->shouldReceive('write')->once()->with("\r02/10 ████████──────────────────────────────── 20% "); - $output->shouldReceive('write')->once()->with("\r03/10 ████████████──────────────────────────── 30% "); - $output->shouldReceive('write')->once()->with("\r04/10 ████████████████──────────────────────── 40% "); - $output->shouldReceive('write')->once()->with("\r05/10 ████████████████████──────────────────── 50% "); - $output->shouldReceive('write')->once()->with("\r06/10 ████████████████████████──────────────── 60% "); - $output->shouldReceive('write')->once()->with("\r07/10 ████████████████████████████──────────── 70% "); - $output->shouldReceive('write')->once()->with("\r08/10 ████████████████████████████████──────── 80% "); - $output->shouldReceive('write')->once()->with("\r09/10 ████████████████████████████████████──── 90% "); - $output->shouldReceive('write')->once()->with("\r10/10 ████████████████████████████████████████ 100% "); + $output->shouldReceive('write')->once()->with("\r00/10 ──────────────────────────────────────── 0.00% "); + $output->shouldReceive('write')->once()->with("\r01/10 ████──────────────────────────────────── 10.00% "); + $output->shouldReceive('write')->once()->with("\r02/10 ████████──────────────────────────────── 20.00% "); + $output->shouldReceive('write')->once()->with("\r03/10 ████████████──────────────────────────── 30.00% "); + $output->shouldReceive('write')->once()->with("\r04/10 ████████████████──────────────────────── 40.00% "); + $output->shouldReceive('write')->once()->with("\r05/10 ████████████████████──────────────────── 50.00% "); + $output->shouldReceive('write')->once()->with("\r06/10 ████████████████████████──────────────── 60.00% "); + $output->shouldReceive('write')->once()->with("\r07/10 ████████████████████████████──────────── 70.00% "); + $output->shouldReceive('write')->once()->with("\r08/10 ████████████████████████████████──────── 80.00% "); + $output->shouldReceive('write')->once()->with("\r09/10 ████████████████████████████████████──── 90.00% "); + $output->shouldReceive('write')->once()->with("\r10/10 ████████████████████████████████████████ 100.00% "); $output->shouldReceive('write')->once()->with(PHP_EOL); $progress = new class ($output, range(1, 10), width: 40) extends ProgressIterator { @@ -125,17 +163,17 @@ public function testProgressWithCustomTemplates(): void $output->shouldReceive('showCursor')->once(); $output->shouldReceive('restoreCursor'); // Destructor - $output->shouldReceive('write')->once()->with("\r00/10 -------------------- 0% "); - $output->shouldReceive('write')->once()->with("\r01/10 ==------------------ 10% "); - $output->shouldReceive('write')->once()->with("\r02/10 ====---------------- 20% "); - $output->shouldReceive('write')->once()->with("\r03/10 ======-------------- 30% "); - $output->shouldReceive('write')->once()->with("\r04/10 ========------------ 40% "); - $output->shouldReceive('write')->once()->with("\r05/10 ==========---------- 50% "); - $output->shouldReceive('write')->once()->with("\r06/10 ============-------- 60% "); - $output->shouldReceive('write')->once()->with("\r07/10 ==============------ 70% "); - $output->shouldReceive('write')->once()->with("\r08/10 ================---- 80% "); - $output->shouldReceive('write')->once()->with("\r09/10 ==================-- 90% "); - $output->shouldReceive('write')->once()->with("\r10/10 ==================== 100% "); + $output->shouldReceive('write')->once()->with("\r00/10 -------------------- 0.00% "); + $output->shouldReceive('write')->once()->with("\r01/10 ==------------------ 10.00% "); + $output->shouldReceive('write')->once()->with("\r02/10 ====---------------- 20.00% "); + $output->shouldReceive('write')->once()->with("\r03/10 ======-------------- 30.00% "); + $output->shouldReceive('write')->once()->with("\r04/10 ========------------ 40.00% "); + $output->shouldReceive('write')->once()->with("\r05/10 ==========---------- 50.00% "); + $output->shouldReceive('write')->once()->with("\r06/10 ============-------- 60.00% "); + $output->shouldReceive('write')->once()->with("\r07/10 ==============------ 70.00% "); + $output->shouldReceive('write')->once()->with("\r08/10 ================---- 80.00% "); + $output->shouldReceive('write')->once()->with("\r09/10 ==================-- 90.00% "); + $output->shouldReceive('write')->once()->with("\r10/10 ==================== 100.00% "); $output->shouldReceive('write')->once()->with(PHP_EOL); $progress = new class ($output, range(1, 10), progressBar: new AsciiProgressBar) extends ProgressIterator { @@ -162,17 +200,17 @@ public function testProgressWithDescription(): void $output->shouldReceive('showCursor')->once(); $output->shouldReceive('restoreCursor'); // Destructor - $output->shouldReceive('write')->once()->with("\rProcessing files: 00/10 ──────────────────── 0% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 01/10 ██────────────────── 10% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 02/10 ████──────────────── 20% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 03/10 ██████────────────── 30% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 04/10 ████████──────────── 40% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 05/10 ██████████────────── 50% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 06/10 ████████████──────── 60% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 07/10 ██████████████────── 70% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 08/10 ████████████████──── 80% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 09/10 ██████████████████── 90% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 10/10 ████████████████████ 100% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 00/10 ──────────────────── 0.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 01/10 ██────────────────── 10.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 02/10 ████──────────────── 20.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 03/10 ██████────────────── 30.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 04/10 ████████──────────── 40.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 05/10 ██████████────────── 50.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 06/10 ████████████──────── 60.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 07/10 ██████████████────── 70.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 08/10 ████████████████──── 80.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 09/10 ██████████████████── 90.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 10/10 ████████████████████ 100.00% "); $output->shouldReceive('write')->once()->with(PHP_EOL); $progress = new class ($output, range(1, 10), description: 'Processing files:') extends ProgressIterator { diff --git a/tests/unit/cli/output/components/ProgressTest.php b/tests/unit/cli/output/components/ProgressTest.php index a3829959b..4ee8a4896 100644 --- a/tests/unit/cli/output/components/ProgressTest.php +++ b/tests/unit/cli/output/components/ProgressTest.php @@ -47,17 +47,17 @@ public function testBasicProgress(): void $output->shouldReceive('showCursor')->once(); $output->shouldReceive('restoreCursor'); // Destructor - $output->shouldReceive('write')->once()->with("\r00/10 ──────────────────── 0% "); - $output->shouldReceive('write')->once()->with("\r01/10 ██────────────────── 10% "); - $output->shouldReceive('write')->once()->with("\r02/10 ████──────────────── 20% "); - $output->shouldReceive('write')->once()->with("\r03/10 ██████────────────── 30% "); - $output->shouldReceive('write')->once()->with("\r04/10 ████████──────────── 40% "); - $output->shouldReceive('write')->once()->with("\r05/10 ██████████────────── 50% "); - $output->shouldReceive('write')->once()->with("\r06/10 ████████████──────── 60% "); - $output->shouldReceive('write')->once()->with("\r07/10 ██████████████────── 70% "); - $output->shouldReceive('write')->once()->with("\r08/10 ████████████████──── 80% "); - $output->shouldReceive('write')->once()->with("\r09/10 ██████████████████── 90% "); - $output->shouldReceive('write')->once()->with("\r10/10 ████████████████████ 100% "); + $output->shouldReceive('write')->once()->with("\r00/10 ──────────────────── 0.00% "); + $output->shouldReceive('write')->once()->with("\r01/10 ██────────────────── 10.00% "); + $output->shouldReceive('write')->once()->with("\r02/10 ████──────────────── 20.00% "); + $output->shouldReceive('write')->once()->with("\r03/10 ██████────────────── 30.00% "); + $output->shouldReceive('write')->once()->with("\r04/10 ████████──────────── 40.00% "); + $output->shouldReceive('write')->once()->with("\r05/10 ██████████────────── 50.00% "); + $output->shouldReceive('write')->once()->with("\r06/10 ████████████──────── 60.00% "); + $output->shouldReceive('write')->once()->with("\r07/10 ██████████████────── 70.00% "); + $output->shouldReceive('write')->once()->with("\r08/10 ████████████████──── 80.00% "); + $output->shouldReceive('write')->once()->with("\r09/10 ██████████████████── 90.00% "); + $output->shouldReceive('write')->once()->with("\r10/10 ████████████████████ 100.00% "); $output->shouldReceive('write')->once()->with(PHP_EOL); $progressBar = new class ($output, 10) extends Progress { @@ -86,17 +86,17 @@ public function testProgressWithCustomWidth(): void $output->shouldReceive('showCursor')->once(); $output->shouldReceive('restoreCursor'); // Destructor - $output->shouldReceive('write')->once()->with("\r00/10 ──────────────────────────────────────── 0% "); - $output->shouldReceive('write')->once()->with("\r01/10 ████──────────────────────────────────── 10% "); - $output->shouldReceive('write')->once()->with("\r02/10 ████████──────────────────────────────── 20% "); - $output->shouldReceive('write')->once()->with("\r03/10 ████████████──────────────────────────── 30% "); - $output->shouldReceive('write')->once()->with("\r04/10 ████████████████──────────────────────── 40% "); - $output->shouldReceive('write')->once()->with("\r05/10 ████████████████████──────────────────── 50% "); - $output->shouldReceive('write')->once()->with("\r06/10 ████████████████████████──────────────── 60% "); - $output->shouldReceive('write')->once()->with("\r07/10 ████████████████████████████──────────── 70% "); - $output->shouldReceive('write')->once()->with("\r08/10 ████████████████████████████████──────── 80% "); - $output->shouldReceive('write')->once()->with("\r09/10 ████████████████████████████████████──── 90% "); - $output->shouldReceive('write')->once()->with("\r10/10 ████████████████████████████████████████ 100% "); + $output->shouldReceive('write')->once()->with("\r00/10 ──────────────────────────────────────── 0.00% "); + $output->shouldReceive('write')->once()->with("\r01/10 ████──────────────────────────────────── 10.00% "); + $output->shouldReceive('write')->once()->with("\r02/10 ████████──────────────────────────────── 20.00% "); + $output->shouldReceive('write')->once()->with("\r03/10 ████████████──────────────────────────── 30.00% "); + $output->shouldReceive('write')->once()->with("\r04/10 ████████████████──────────────────────── 40.00% "); + $output->shouldReceive('write')->once()->with("\r05/10 ████████████████████──────────────────── 50.00% "); + $output->shouldReceive('write')->once()->with("\r06/10 ████████████████████████──────────────── 60.00% "); + $output->shouldReceive('write')->once()->with("\r07/10 ████████████████████████████──────────── 70.00% "); + $output->shouldReceive('write')->once()->with("\r08/10 ████████████████████████████████──────── 80.00% "); + $output->shouldReceive('write')->once()->with("\r09/10 ████████████████████████████████████──── 90.00% "); + $output->shouldReceive('write')->once()->with("\r10/10 ████████████████████████████████████████ 100.00% "); $output->shouldReceive('write')->once()->with(PHP_EOL); $progressBar = new class ($output, 10, width: 40) extends Progress { @@ -125,17 +125,17 @@ public function testProgressWithCustomTemplates(): void $output->shouldReceive('showCursor')->once(); $output->shouldReceive('restoreCursor'); // Destructor - $output->shouldReceive('write')->once()->with("\r00/10 -------------------- 0% "); - $output->shouldReceive('write')->once()->with("\r01/10 ==------------------ 10% "); - $output->shouldReceive('write')->once()->with("\r02/10 ====---------------- 20% "); - $output->shouldReceive('write')->once()->with("\r03/10 ======-------------- 30% "); - $output->shouldReceive('write')->once()->with("\r04/10 ========------------ 40% "); - $output->shouldReceive('write')->once()->with("\r05/10 ==========---------- 50% "); - $output->shouldReceive('write')->once()->with("\r06/10 ============-------- 60% "); - $output->shouldReceive('write')->once()->with("\r07/10 ==============------ 70% "); - $output->shouldReceive('write')->once()->with("\r08/10 ================---- 80% "); - $output->shouldReceive('write')->once()->with("\r09/10 ==================-- 90% "); - $output->shouldReceive('write')->once()->with("\r10/10 ==================== 100% "); + $output->shouldReceive('write')->once()->with("\r00/10 -------------------- 0.00% "); + $output->shouldReceive('write')->once()->with("\r01/10 ==------------------ 10.00% "); + $output->shouldReceive('write')->once()->with("\r02/10 ====---------------- 20.00% "); + $output->shouldReceive('write')->once()->with("\r03/10 ======-------------- 30.00% "); + $output->shouldReceive('write')->once()->with("\r04/10 ========------------ 40.00% "); + $output->shouldReceive('write')->once()->with("\r05/10 ==========---------- 50.00% "); + $output->shouldReceive('write')->once()->with("\r06/10 ============-------- 60.00% "); + $output->shouldReceive('write')->once()->with("\r07/10 ==============------ 70.00% "); + $output->shouldReceive('write')->once()->with("\r08/10 ================---- 80.00% "); + $output->shouldReceive('write')->once()->with("\r09/10 ==================-- 90.00% "); + $output->shouldReceive('write')->once()->with("\r10/10 ==================== 100.00% "); $output->shouldReceive('write')->once()->with(PHP_EOL); $progressBar = new class ($output, 10, progressBar: new AsciiProgressBar) extends Progress { @@ -164,17 +164,17 @@ public function testProgressWithDescription(): void $output->shouldReceive('showCursor')->once(); $output->shouldReceive('restoreCursor'); // Destructor - $output->shouldReceive('write')->once()->with("\rProcessing files: 00/10 ──────────────────── 0% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 01/10 ██────────────────── 10% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 02/10 ████──────────────── 20% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 03/10 ██████────────────── 30% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 04/10 ████████──────────── 40% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 05/10 ██████████────────── 50% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 06/10 ████████████──────── 60% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 07/10 ██████████████────── 70% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 08/10 ████████████████──── 80% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 09/10 ██████████████████── 90% "); - $output->shouldReceive('write')->once()->with("\rProcessing files: 10/10 ████████████████████ 100% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 00/10 ──────────────────── 0.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 01/10 ██────────────────── 10.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 02/10 ████──────────────── 20.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 03/10 ██████────────────── 30.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 04/10 ████████──────────── 40.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 05/10 ██████████────────── 50.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 06/10 ████████████──────── 60.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 07/10 ██████████████────── 70.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 08/10 ████████████████──── 80.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 09/10 ██████████████████── 90.00% "); + $output->shouldReceive('write')->once()->with("\rProcessing files: 10/10 ████████████████████ 100.00% "); $output->shouldReceive('write')->once()->with(PHP_EOL); $progressBar = new class ($output, 10, description: 'Processing files:') extends Progress { @@ -301,7 +301,7 @@ public function testRemoveIncomplete(): void $output->shouldReceive('clearLines')->once()->with(1); - $output->shouldReceive('write')->once()->with("\r00/10 ──────────────────── 0% "); + $output->shouldReceive('write')->once()->with("\r00/10 ──────────────────── 0.00% "); $progressBar = new Progress($output, 10); @@ -324,17 +324,17 @@ public function testRemoveComplete(): void $output->shouldReceive('clearLines')->once()->with(2); - $output->shouldReceive('write')->once()->with("\r00/10 ──────────────────── 0% "); - $output->shouldReceive('write')->once()->with("\r01/10 ██────────────────── 10% "); - $output->shouldReceive('write')->once()->with("\r02/10 ████──────────────── 20% "); - $output->shouldReceive('write')->once()->with("\r03/10 ██████────────────── 30% "); - $output->shouldReceive('write')->once()->with("\r04/10 ████████──────────── 40% "); - $output->shouldReceive('write')->once()->with("\r05/10 ██████████────────── 50% "); - $output->shouldReceive('write')->once()->with("\r06/10 ████████████──────── 60% "); - $output->shouldReceive('write')->once()->with("\r07/10 ██████████████────── 70% "); - $output->shouldReceive('write')->once()->with("\r08/10 ████████████████──── 80% "); - $output->shouldReceive('write')->once()->with("\r09/10 ██████████████████── 90% "); - $output->shouldReceive('write')->once()->with("\r10/10 ████████████████████ 100% "); + $output->shouldReceive('write')->once()->with("\r00/10 ──────────────────── 0.00% "); + $output->shouldReceive('write')->once()->with("\r01/10 ██────────────────── 10.00% "); + $output->shouldReceive('write')->once()->with("\r02/10 ████──────────────── 20.00% "); + $output->shouldReceive('write')->once()->with("\r03/10 ██████────────────── 30.00% "); + $output->shouldReceive('write')->once()->with("\r04/10 ████████──────────── 40.00% "); + $output->shouldReceive('write')->once()->with("\r05/10 ██████████────────── 50.00% "); + $output->shouldReceive('write')->once()->with("\r06/10 ████████████──────── 60.00% "); + $output->shouldReceive('write')->once()->with("\r07/10 ██████████████────── 70.00% "); + $output->shouldReceive('write')->once()->with("\r08/10 ████████████████──── 80.00% "); + $output->shouldReceive('write')->once()->with("\r09/10 ██████████████████── 90.00% "); + $output->shouldReceive('write')->once()->with("\r10/10 ████████████████████ 100.00% "); $output->shouldReceive('write')->once()->with(PHP_EOL); $progressBar = new class ($output, 10) extends Progress {