Skip to content

Commit

Permalink
Fixed ParallelAnalyserIntegrationTest on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Mar 15, 2020
1 parent 1fd93f8 commit 09733b5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/PHPStan/Parallel/ParallelAnalyserIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace PHPStan\Parallel;

use Nette\Utils\Json;
use PHPStan\File\FileHelper;
use PHPUnit\Framework\TestCase;

class ParallelAnalyserIntegrationTest extends TestCase
Expand All @@ -22,13 +23,13 @@ public function dataRun(): array
*/
public function testRun(string $command): void
{
exec(sprintf('%s %s clear-result-cache --configuration %s', escapeshellarg(PHP_BINARY), escapeshellarg(__DIR__ . '/../../../bin/phpstan'), escapeshellarg(__DIR__ . '/parallel-analyser.neon')), $clearResultCacheOutputLines, $clearResultCacheExitCode);
exec(sprintf('%s %s clear-result-cache --configuration %s -q', escapeshellarg(PHP_BINARY), escapeshellarg(__DIR__ . '/../../../bin/phpstan'), escapeshellarg(__DIR__ . '/parallel-analyser.neon')), $clearResultCacheOutputLines, $clearResultCacheExitCode);
if ($clearResultCacheExitCode !== 0) {
throw new \PHPStan\ShouldNotHappenException('Could not clear result cache.');
}

exec(sprintf(
'%s %s %s -l 8 -c %s --error-format json %s',
'%s %s %s -l 8 -c %s --error-format json --no-progress %s',
escapeshellarg(PHP_BINARY),
escapeshellarg(__DIR__ . '/../../../bin/phpstan'),
$command,
Expand All @@ -41,13 +42,16 @@ public function testRun(string $command): void
]))
), $outputLines, $exitCode);
$output = implode("\n", $outputLines);

$fileHelper = new FileHelper(__DIR__);
$filePath = $fileHelper->normalizePath(__DIR__ . '/data/trait-definition.php');
$this->assertJsonStringEqualsJsonString(Json::encode([
'totals' => [
'errors' => 0,
'file_errors' => 3,
],
'files' => [
sprintf('%s/data/trait-definition.php (in context of class ParallelAnalyserIntegrationTest\\Bar)', __DIR__) => [
sprintf('%s (in context of class ParallelAnalyserIntegrationTest\\Bar)', $filePath) => [
'errors' => 1,
'messages' => [
[
Expand All @@ -57,7 +61,7 @@ public function testRun(string $command): void
],
],
],
sprintf('%s/data/trait-definition.php (in context of class ParallelAnalyserIntegrationTest\\Foo)', __DIR__) => [
sprintf('%s (in context of class ParallelAnalyserIntegrationTest\\Foo)', $filePath) => [
'errors' => 2,
'messages' => [
[
Expand Down

0 comments on commit 09733b5

Please sign in to comment.