Skip to content

Commit 44ba333

Browse files
committed
Fix
1 parent 5ffe1b4 commit 44ba333

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/PHPStan/Command/ErrorFormatter/BaselineNeonErrorFormatterIntegrationTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Nette\Utils\Json;
66
use PHPUnit\Framework\TestCase;
77
use function chdir;
8-
use function file_put_contents;
98
use function getcwd;
109

1110
/**
@@ -24,9 +23,8 @@ public function testErrorWithTrait(): void
2423

2524
public function testGenerateBaselineAndRunAgainWithIt(): void
2625
{
27-
$output = $this->runPhpStan(__DIR__ . '/data/', __DIR__ . '/empty.neon', 'baselineNeon');
2826
$baselineFile = __DIR__ . '/../../../../baseline.neon';
29-
file_put_contents($baselineFile, $output);
27+
$output = $this->runPhpStan(__DIR__ . '/data/', __DIR__ . '/empty.neon', 'json', $baselineFile);
3028

3129
$output = $this->runPhpStan(__DIR__ . '/data/', $baselineFile);
3230
@unlink($baselineFile);
@@ -54,7 +52,8 @@ public function testRunUnixFileWithWindowsBaseline(): void
5452
private function runPhpStan(
5553
string $analysedPath,
5654
?string $configFile,
57-
string $errorFormatter = 'json'
55+
string $errorFormatter = 'json',
56+
?string $baselineFile = null
5857
): string
5958
{
6059
$originalDir = getcwd();
@@ -67,7 +66,7 @@ private function runPhpStan(
6766
throw new \PHPStan\ShouldNotHappenException('Could not clear result cache.');
6867
}
6968

70-
exec(sprintf('%s %s analyse --no-progress --error-format=%s --level=7 %s %s', escapeshellarg(PHP_BINARY), 'bin/phpstan', $errorFormatter, $configFile !== null ? '--configuration ' . escapeshellarg($configFile) : '', escapeshellarg($analysedPath)), $outputLines);
69+
exec(sprintf('%s %s analyse --no-progress --error-format=%s --level=7 %s %s%s', escapeshellarg(PHP_BINARY), 'bin/phpstan', $errorFormatter, $configFile !== null ? '--configuration ' . escapeshellarg($configFile) : '', escapeshellarg($analysedPath), $baselineFile !== null ? ' --generate-baseline ' . escapeshellarg($baselineFile) : ''), $outputLines);
7170
chdir($originalDir);
7271

7372
return implode("\n", $outputLines);

0 commit comments

Comments
 (0)