Skip to content

Commit 0a3e1a7

Browse files
committed
LevelsTestCase - clear result cache just once
1 parent 4718095 commit 0a3e1a7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Testing/LevelsTestCase.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,13 @@ public function testLevels(
6363

6464
$exceptions = [];
6565

66+
exec(sprintf('%s %s clear-result-cache %s 2>&1', escapeshellarg(PHP_BINARY), $command, $configPath !== null ? '--configuration ' . escapeshellarg($configPath) : ''), $clearResultCacheOutputLines, $clearResultCacheExitCode);
67+
if ($clearResultCacheExitCode !== 0) {
68+
throw new ShouldNotHappenException('Could not clear result cache: ' . implode("\n", $clearResultCacheOutputLines));
69+
}
70+
6671
foreach (range(0, 9) as $level) {
6772
unset($outputLines);
68-
exec(sprintf('%s %s clear-result-cache %s 2>&1', escapeshellarg(PHP_BINARY), $command, $configPath !== null ? '--configuration ' . escapeshellarg($configPath) : ''), $clearResultCacheOutputLines, $clearResultCacheExitCode);
69-
if ($clearResultCacheExitCode !== 0) {
70-
throw new ShouldNotHappenException('Could not clear result cache: ' . implode("\n", $clearResultCacheOutputLines));
71-
}
7273
exec(sprintf('%s %s analyse --no-progress --error-format=prettyJson --level=%d %s %s %s', escapeshellarg(PHP_BINARY), $command, $level, $configPath !== null ? '--configuration ' . escapeshellarg($configPath) : '', $this->shouldAutoloadAnalysedFile() ? sprintf('--autoload-file %s', escapeshellarg($file)) : '', escapeshellarg($file)), $outputLines);
7374

7475
$output = implode("\n", $outputLines);

0 commit comments

Comments
 (0)