File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
tests/PHPStan/Rules/Keywords Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -67,4 +67,40 @@ public function testFileDoesNotExistConditionally(): void
67
67
]);
68
68
}
69
69
70
+ public function testRelativePathWithoutIncludePath (): void
71
+ {
72
+ $ this ->analyse ([__DIR__ . '/data/require-file-relative-path.php ' ], [
73
+ [
74
+ 'Path in include() "RequireFileExistsRuleTest.php" is not a file or it does not exist. ' ,
75
+ 3 ,
76
+ ],
77
+ [
78
+ 'Path in include_once() "RequireFileExistsRuleTest.php" is not a file or it does not exist. ' ,
79
+ 4 ,
80
+ ],
81
+ [
82
+ 'Path in require() "RequireFileExistsRuleTest.php" is not a file or it does not exist. ' ,
83
+ 5 ,
84
+ ],
85
+ [
86
+ 'Path in require_once() "RequireFileExistsRuleTest.php" is not a file or it does not exist. ' ,
87
+ 6 ,
88
+ ],
89
+ ]);
90
+ }
91
+
92
+ public function testRelativePathWithIncludePath (): void
93
+ {
94
+ $ includePaths = [realpath (__DIR__ )];
95
+ $ includePaths [] = get_include_path ();
96
+
97
+ set_include_path (implode (PATH_SEPARATOR , $ includePaths ));
98
+
99
+ try {
100
+ $ this ->analyse ([__DIR__ . '/data/require-file-relative-path.php ' ], []);
101
+ } finally {
102
+ set_include_path ($ includePaths [1 ]);
103
+ }
104
+ }
105
+
70
106
}
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types=1 );
2
+
3
+ include 'RequireFileExistsRuleTest.php ' ;
4
+ include_once 'RequireFileExistsRuleTest.php ' ;
5
+ require 'RequireFileExistsRuleTest.php ' ;
6
+ require_once 'RequireFileExistsRuleTest.php ' ;
7
+
You can’t perform that action at this time.
0 commit comments