Skip to content

Commit 7c92ff9

Browse files
committed
Revert "Temporarily remove InvalidIgnoredErrorExceptionTest because it causes whole test suite instability"
This reverts commit 9ddddab804609ff34cc3917ff6839f6f2f370f55.
1 parent ecf4353 commit 7c92ff9

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\DependencyInjection;
4+
5+
use PHPStan\Testing\PHPStanTestCase;
6+
use PHPUnit\Framework\Attributes\DataProvider;
7+
8+
class InvalidIgnoredErrorExceptionTest extends PHPStanTestCase
9+
{
10+
11+
private static string $configFile;
12+
13+
/**
14+
* @return iterable<array{string, string}>
15+
*/
16+
public static function dataValidateIgnoreErrors(): iterable
17+
{
18+
yield [
19+
__DIR__ . '/invalidIgnoreErrors/message-and-messages.neon',
20+
'An ignoreErrors entry cannot contain both message and messages fields.',
21+
];
22+
yield [
23+
__DIR__ . '/invalidIgnoreErrors/rawMessage-and-message.neon',
24+
'An ignoreErrors entry cannot contain both rawMessage and message fields.',
25+
];
26+
yield [
27+
__DIR__ . '/invalidIgnoreErrors/rawMessage-and-messages.neon',
28+
'An ignoreErrors entry cannot contain both rawMessage and messages fields.',
29+
];
30+
yield [
31+
__DIR__ . '/invalidIgnoreErrors/identifier-and-identifiers.neon',
32+
'An ignoreErrors entry cannot contain both identifier and identifiers fields.',
33+
];
34+
yield [
35+
__DIR__ . '/invalidIgnoreErrors/path-and-paths.neon',
36+
'An ignoreErrors entry cannot contain both path and paths fields.',
37+
];
38+
yield [
39+
__DIR__ . '/invalidIgnoreErrors/missing-main-key.neon',
40+
'An ignoreErrors entry must contain at least one of the following fields: message, messages, rawMessage, identifier, identifiers, path, paths.',
41+
];
42+
yield [
43+
__DIR__ . '/invalidIgnoreErrors/count-without-path.neon',
44+
'An ignoreErrors entry with count field must also contain path field.',
45+
];
46+
}
47+
48+
#[DataProvider('dataValidateIgnoreErrors')]
49+
public function testValidateIgnoreErrors(string $file, string $expectedMessage): void
50+
{
51+
self::$configFile = $file;
52+
$this->expectExceptionMessage($expectedMessage);
53+
self::getContainer();
54+
}
55+
56+
public static function getAdditionalConfigFiles(): array
57+
{
58+
return [
59+
__DIR__ . '/../../../conf/bleedingEdge.neon',
60+
self::$configFile,
61+
];
62+
}
63+
64+
}

0 commit comments

Comments
 (0)