@@ -64,19 +64,17 @@ public function test_it_can_run_the_command_without_sub_processes(): void
64
64
Processing 5 items in segments of 2, batches of 2, 1 round, 1 batch in 1 process
65
65
66
66
0/5 [>---------------------------] 0% 10 secs/10 secs 10.0 MiB
67
- 1/5 [=====>----------------------] 20% 10 secs/10 secs 10.0 MiB
68
- 2/5 [===========>----------------] 40% 10 secs/10 secs 10.0 MiB
69
- 3/5 [================>-----------] 60% 10 secs/10 secs 10.0 MiB
70
- 4/5 [======================>-----] 80% 10 secs/10 secs 10.0 MiB
71
67
5/5 [============================] 100% 10 secs/10 secs 10.0 MiB
72
68
73
69
Processed 5 items.
74
70
75
71
EOF;
76
72
77
- $ actual = $ this ->getOutput ($ commandTester );
73
+ $ actual = self ::normalizeIntermediateProgressBars (
74
+ $ this ->getOutput ($ commandTester ),
75
+ );
78
76
79
- self ::assertSame ($ expected , $ actual );
77
+ self ::assertSame ($ expected , $ actual, $ actual );
80
78
}
81
79
82
80
public function test_it_uses_a_sub_process_if_only_one_process_is_used (): void
@@ -112,15 +110,15 @@ public function test_it_can_run_the_command_with_multiple_processes(): void
112
110
Processing 5 movies in segments of 2, batches of 2, 3 rounds, 3 batches in 2 processes
113
111
114
112
0/5 [>---------------------------] 0% 10 secs/10 secs 10.0 MiB
115
- 2/5 [===========>----------------] 40% 10 secs/10 secs 10.0 MiB
116
- 4/5 [======================>-----] 80% 10 secs/10 secs 10.0 MiB
117
113
5/5 [============================] 100% 10 secs/10 secs 10.0 MiB
118
114
119
115
Processed 5 movies.
120
116
121
117
EOF;
122
118
123
- $ actual = $ this ->getOutput ($ commandTester );
119
+ $ actual = self ::normalizeIntermediateProgressBars (
120
+ $ this ->getOutput ($ commandTester ),
121
+ );
124
122
125
123
self ::assertSame ($ expected , $ actual , $ actual );
126
124
}
@@ -144,8 +142,6 @@ public function test_it_can_run_the_command_with_multiple_processes_in_debug_mod
144
142
Processing 5 movies in segments of 2, batches of 2, 3 rounds, 3 batches in 2 processes
145
143
146
144
0/5 [>---------------------------] 0% 10 secs/10 secs 10.0 MiB
147
- 2/5 [===========>----------------] 40% 10 secs/10 secs 10.0 MiB
148
- 4/5 [======================>-----] 80% 10 secs/10 secs 10.0 MiB
149
145
5/5 [============================] 100% 10 secs/10 secs 10.0 MiB
150
146
151
147
Processed 5 movies.
@@ -158,10 +154,12 @@ public function test_it_can_run_the_command_with_multiple_processes_in_debug_mod
158
154
$ expectedCommandStartedLine = "[debug] Command started: '/path/to/php' '/path/to/work-dir/bin/console' 'import:movies' '--child' \n" ;
159
155
$ expectedCommandFinishedLine = "[debug] Command finished \n" ;
160
156
161
- $ outputWithoutExtraDebugInfo = str_replace (
162
- [$ expectedCommandStartedLine , $ expectedCommandFinishedLine ],
163
- ['' , '' ],
164
- $ actual ,
157
+ $ outputWithoutExtraDebugInfo = self ::normalizeIntermediateProgressBars (
158
+ str_replace (
159
+ [$ expectedCommandStartedLine , $ expectedCommandFinishedLine ],
160
+ ['' , '' ],
161
+ $ actual ,
162
+ ),
165
163
);
166
164
167
165
self ::assertSame ($ expectedWithNoDebugMode , $ outputWithoutExtraDebugInfo , $ outputWithoutExtraDebugInfo );
@@ -216,4 +214,13 @@ private static function normalizeConsolePath(string $output): string
216
214
$ output ,
217
215
);
218
216
}
217
+
218
+ private static function normalizeIntermediateProgressBars (string $ output ): string
219
+ {
220
+ return preg_replace (
221
+ '# *?[1-4]/5 \[[=>-]+\] \d+% 10 secs/10 secs 10.0 MiB\n# ' ,
222
+ '' ,
223
+ $ output ,
224
+ );
225
+ }
219
226
}
0 commit comments