Skip to content

Commit d08f967

Browse files
committed
support also Behat tests file structure
1 parent 5e492e7 commit d08f967

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/main/java/de/espend/idea/php/phpunit/utils/PhpUnitPluginUtil.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ public static boolean isTestClassWithoutIndexAccess(@NotNull PhpClass phpClass)
7676
}
7777

7878
for (String interfaceName : phpClass.getInterfaceNames()) {
79-
String interfaceName2 = "\\" + StringUtils.stripStart(interfaceName, "\\");
80-
if (interfaceName2.equalsIgnoreCase("\\Behat\\Behat\\Context\\Context")) {
79+
String interfaceNameNormalized = "\\" + StringUtils.stripStart(interfaceName, "\\");
80+
if (interfaceNameNormalized.equalsIgnoreCase("\\Behat\\Behat\\Context\\Context")) {
8181
return true;
8282
}
8383
}
@@ -87,7 +87,16 @@ public static boolean isTestClassWithoutIndexAccess(@NotNull PhpClass phpClass)
8787
for (VirtualFile contentRoot : ProjectRootManager.getInstance(phpClass.getProject()).getContentRoots()) {
8888
String relativePath = VfsUtil.getRelativePath(containingFile1, contentRoot, '/');
8989

90-
if (relativePath != null && (relativePath.toLowerCase().contains("/test/") || relativePath.toLowerCase().contains("/tests/"))) {
90+
if (relativePath == null) {
91+
continue;
92+
}
93+
94+
// PhpUnit and Behat folder structure
95+
if (relativePath.toLowerCase().contains("/test/") ||
96+
relativePath.toLowerCase().contains("/tests/") ||
97+
relativePath.toLowerCase().contains("/feature/") ||
98+
relativePath.toLowerCase().contains("/features/")
99+
) {
91100
return true;
92101
}
93102
}

0 commit comments

Comments
 (0)