File tree 1 file changed +4
-21
lines changed
tests/PHPStan/Rules/Keywords
1 file changed +4
-21
lines changed Original file line number Diff line number Diff line change 16
16
class RequireFileExistsRuleTest extends RuleTestCase
17
17
{
18
18
19
- private RequireFileExistsRule $ rule ;
20
-
21
- public function setUp (): void
22
- {
23
- parent ::setUp ();
24
-
25
- $ this ->rule = $ this ->getDefaultRule ();
26
- }
19
+ private string $ currentWorkingDirectory = __DIR__ . '/../ ' ;
27
20
28
21
protected function getRule (): Rule
29
22
{
30
- return $ this ->rule ;
23
+ return new RequireFileExistsRule ( $ this ->currentWorkingDirectory ) ;
31
24
}
32
25
33
26
public static function getAdditionalConfigFiles (): array
@@ -37,11 +30,6 @@ public static function getAdditionalConfigFiles(): array
37
30
];
38
31
}
39
32
40
- private function getDefaultRule (): RequireFileExistsRule
41
- {
42
- return new RequireFileExistsRule (__DIR__ . '/../ ' );
43
- }
44
-
45
33
public function testBasicCase (): void
46
34
{
47
35
$ this ->analyse ([__DIR__ . '/data/require-file-simple-case.php ' ], [
@@ -124,13 +112,8 @@ public function testRelativePathWithIncludePath(): void
124
112
125
113
public function testRelativePathWithSameWorkingDirectory (): void
126
114
{
127
- $ this ->rule = new RequireFileExistsRule (__DIR__ );
128
-
129
- try {
130
- $ this ->analyse ([__DIR__ . '/data/require-file-relative-path.php ' ], []);
131
- } finally {
132
- $ this ->rule = $ this ->getDefaultRule ();
133
- }
115
+ $ this ->currentWorkingDirectory = __DIR__ ;
116
+ $ this ->analyse ([__DIR__ . '/data/require-file-relative-path.php ' ], []);
134
117
}
135
118
136
119
}
You can’t perform that action at this time.
0 commit comments