-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
ForbiddenNestedCallInAssertMethodCallRuleTest.php
48 lines (40 loc) · 1.44 KB
/
ForbiddenNestedCallInAssertMethodCallRuleTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
declare(strict_types=1);
namespace Symplify\PHPStanRules\Tests\Rules\ForbiddenNestedCallInAssertMethodCallRule;
use Iterator;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use Symplify\PHPStanRules\Rules\ForbiddenNestedCallInAssertMethodCallRule;
final class ForbiddenNestedCallInAssertMethodCallRuleTest extends RuleTestCase
{
/**
* @param mixed[] $expectedErrorMessagesWithLines
*/
#[DataProvider('provideData')]
public function testRule(string $filePath, array $expectedErrorMessagesWithLines): void
{
$this->analyse([$filePath], $expectedErrorMessagesWithLines);
}
public static function provideData(): Iterator
{
yield [__DIR__ . '/Fixture/SkipAssertNothing.php', []];
yield [__DIR__ . '/Fixture/SkipCleanAssert.php', []];
yield [__DIR__ . '/Fixture/SkipSimpleGetter.php', []];
yield [__DIR__ . '/Fixture/SkipAssertTrue.php', []];
yield [__DIR__ . '/Fixture/NestedAssertMethodCall.php', [
[ForbiddenNestedCallInAssertMethodCallRule::ERROR_MESSAGE, 14],
]];
}
/**
* @return string[]
*/
public static function getAdditionalConfigFiles(): array
{
return [__DIR__ . '/config/configured_rule.neon'];
}
protected function getRule(): Rule
{
return self::getContainer()->getByType(ForbiddenNestedCallInAssertMethodCallRule::class);
}
}