Skip to content

Commit dd4bac9

Browse files
authored
test: Fix flaky test (#906)
1 parent 3f8c3c3 commit dd4bac9

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

tests/Console/Command/AddPrefixCommandIntegrationTest.php

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -145,24 +145,11 @@ public function test_scope_in_normal_mode(): void
145145

146146
EOF;
147147

148-
$extraNormalization = static fn (string $display) => str_replace(
149-
[
150-
'
151-
1/4 [▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░] 25%',
152-
'
153-
2/4 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░] 50%',
154-
'
155-
3/4 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░] 75%',
156-
],
157-
['', '', ''],
158-
$display,
159-
);
160-
161148
$this->assertExpectedOutput(
162149
$expected,
163150
0,
164151
$this->createDisplayNormalizer(),
165-
$extraNormalization,
152+
self::replaceIntermediateProgressBarSteps(...),
166153
);
167154
}
168155

@@ -349,4 +336,30 @@ static function (array $collectedFiles, SplFileInfo $file) use ($dir): array {
349336
[],
350337
);
351338
}
339+
340+
private static function replaceIntermediateProgressBarSteps(string $output): string
341+
{
342+
return str_replace(
343+
[
344+
<<<'EOF'
345+
346+
1/5 [▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░] 20%
347+
EOF,
348+
<<<'EOF'
349+
350+
2/5 [▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░] 40%
351+
EOF,
352+
<<<'EOF'
353+
354+
3/5 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░] 60%
355+
EOF,
356+
<<<'EOF'
357+
358+
4/5 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░] 80%
359+
EOF,
360+
],
361+
['', '', ''],
362+
$output,
363+
);
364+
}
352365
}

0 commit comments

Comments
 (0)