|
3 | 3 | namespace PHPStan\Tests; |
4 | 4 |
|
5 | 5 | use Nette\Utils\Json; |
| 6 | +use PHPStan\File\FileHelper; |
6 | 7 | use PHPStan\File\FileReader; |
7 | 8 | use PHPStan\File\SimpleRelativePathHelper; |
8 | 9 | use PHPUnit\Framework\TestCase; |
@@ -97,10 +98,16 @@ public function testResultCacheDeleteFile(): void |
97 | 98 | $originalSerializerCode = $serializerCode; |
98 | 99 | unlink($serializerPath); |
99 | 100 |
|
| 101 | + $fileHelper = new FileHelper(__DIR__); |
| 102 | + |
100 | 103 | $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)); |
102 | 105 | $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']); |
104 | 111 |
|
105 | 112 | file_put_contents($serializerPath, $originalSerializerCode); |
106 | 113 | $this->runPhpstan(0); |
|
0 commit comments