Skip to content

Commit 250415e

Browse files
committed
Fix
1 parent 656dfe5 commit 250415e

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

tests/e2e/ResultCacheEndToEndTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PHPStan\Tests;
44

55
use Nette\Utils\Json;
6+
use PHPStan\File\FileHelper;
67
use PHPStan\File\FileReader;
78
use PHPStan\File\SimpleRelativePathHelper;
89
use PHPUnit\Framework\TestCase;
@@ -97,10 +98,16 @@ public function testResultCacheDeleteFile(): void
9798
$originalSerializerCode = $serializerCode;
9899
unlink($serializerPath);
99100

101+
$fileHelper = new FileHelper(__DIR__);
102+
100103
$result = $this->runPhpstan(1);
101-
$this->assertSame(1, $result['totals']['file_errors'], Json::encode($result));
104+
$this->assertSame(2, $result['totals']['file_errors'], Json::encode($result));
102105
$this->assertSame(0, $result['totals']['errors'], Json::encode($result));
103-
$this->assertSame('Reflection error: PhpParser\Serializer not found.', $result['files'][__DIR__ . '/PHP-Parser/lib/PhpParser/Serializer/XML.php']['messages'][0]['message']);
106+
107+
$message = $result['files'][$fileHelper->normalizePath(__DIR__ . '/PHP-Parser/lib/PhpParser/Serializer/XML.php')]['messages'][0]['message'];
108+
$this->assertStringContainsString('Ignored error pattern #^Argument of an invalid type PhpParser\\\\Node supplied for foreach, only iterables are supported\\.$# in path', $message);
109+
$this->assertStringContainsString('was not matched in reported errors.', $message);
110+
$this->assertSame('Reflection error: PhpParser\Serializer not found.', $result['files'][$fileHelper->normalizePath(__DIR__ . '/PHP-Parser/lib/PhpParser/Serializer/XML.php')]['messages'][1]['message']);
104111

105112
file_put_contents($serializerPath, $originalSerializerCode);
106113
$this->runPhpstan(0);

0 commit comments

Comments
 (0)