File tree Expand file tree Collapse file tree 1 file changed +4
-21
lines changed
tests/PHPStan/Rules/Keywords Expand file tree Collapse file tree 1 file changed +4
-21
lines changed Original file line number Diff line number Diff line change 1616class RequireFileExistsRuleTest extends RuleTestCase
1717{
1818
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__ . '/../ ' ;
2720
2821 protected function getRule (): Rule
2922 {
30- return $ this ->rule ;
23+ return new RequireFileExistsRule ( $ this ->currentWorkingDirectory ) ;
3124 }
3225
3326 public static function getAdditionalConfigFiles (): array
@@ -37,11 +30,6 @@ public static function getAdditionalConfigFiles(): array
3730 ];
3831 }
3932
40- private function getDefaultRule (): RequireFileExistsRule
41- {
42- return new RequireFileExistsRule (__DIR__ . '/../ ' );
43- }
44-
4533 public function testBasicCase (): void
4634 {
4735 $ this ->analyse ([__DIR__ . '/data/require-file-simple-case.php ' ], [
@@ -124,13 +112,8 @@ public function testRelativePathWithIncludePath(): void
124112
125113 public function testRelativePathWithSameWorkingDirectory (): void
126114 {
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 ' ], []);
134117 }
135118
136119}
You can’t perform that action at this time.
0 commit comments