forked from mglaman/phpstan-drupal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoadIncludesRuleTest.php
More file actions
76 lines (65 loc) · 2.09 KB
/
LoadIncludesRuleTest.php
File metadata and controls
76 lines (65 loc) · 2.09 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php declare(strict_types=1);
namespace mglaman\PHPStanDrupal\Tests\Rules;
use mglaman\PHPStanDrupal\Rules\Drupal\LoadIncludes;
use mglaman\PHPStanDrupal\Tests\DrupalRuleTestCase;
final class LoadIncludesRuleTest extends DrupalRuleTestCase
{
protected function getRule(): \PHPStan\Rules\Rule
{
return self::getContainer()->getByType(LoadIncludes::class);
}
/**
* @dataProvider cases
*
* @param list<array{0: string, 1: int, 2?: string|null}> $errors
*/
public function test(array $files, array $errors): void
{
$this->analyse($files, $errors);
}
public static function cases(): \Generator
{
yield [
[
__DIR__ . '/../../fixtures/drupal/modules/phpstan_fixtures/phpstan_fixtures.module'
],
[
[
'File modules/phpstan_fixtures/phpstan_fixtures.fetch.inc could not be loaded from Drupal\Core\Extension\ModuleHandlerInterface::loadInclude',
25,
]
],
];
yield [
[
__DIR__ . '/../../fixtures/drupal/core/tests/Drupal/Tests/Core/Form/FormStateTest.php'
],
[],
];
yield 'bug-516.php' => [
[__DIR__.'/data/bug-516.php'],
[]
];
yield 'bug-547.php' => [
[__DIR__.'/data/bug-547.php'],
[]
];
yield 'bug-177.php' => [
[__DIR__.'/data/bug-177.php'],
[
[
'File core/modules/locale/locale.fetch.php could not be loaded from Drupal\Core\Extension\ModuleHandlerInterface::loadInclude',
6
],
[
'File core/modules/locale/locale.fetch.php could not be loaded from Drupal\Core\Extension\ModuleHandlerInterface::loadInclude',
8
],
]
];
yield 'multisite module in sites/acme/' => [
[__DIR__.'/data/multisite-load-include.php'],
[]
];
}
}