Skip to content

Commit

Permalink
LevelsTestCase - clear result cache just once
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Mar 27, 2022
1 parent 4718095 commit 0a3e1a7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Testing/LevelsTestCase.php
Expand Up @@ -63,12 +63,13 @@ public function testLevels(

$exceptions = [];

exec(sprintf('%s %s clear-result-cache %s 2>&1', escapeshellarg(PHP_BINARY), $command, $configPath !== null ? '--configuration ' . escapeshellarg($configPath) : ''), $clearResultCacheOutputLines, $clearResultCacheExitCode);
if ($clearResultCacheExitCode !== 0) {
throw new ShouldNotHappenException('Could not clear result cache: ' . implode("\n", $clearResultCacheOutputLines));
}

foreach (range(0, 9) as $level) {
unset($outputLines);
exec(sprintf('%s %s clear-result-cache %s 2>&1', escapeshellarg(PHP_BINARY), $command, $configPath !== null ? '--configuration ' . escapeshellarg($configPath) : ''), $clearResultCacheOutputLines, $clearResultCacheExitCode);
if ($clearResultCacheExitCode !== 0) {
throw new ShouldNotHappenException('Could not clear result cache: ' . implode("\n", $clearResultCacheOutputLines));
}
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);

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

0 comments on commit 0a3e1a7

Please sign in to comment.