Skip to content

Commit f0201e5

Browse files
committed
MQE-980: [Annotations] <features> tag defaults to module
- CR Fixes
1 parent 6a94c87 commit f0201e5

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

src/Magento/FunctionalTestingFramework/Test/Util/TestObjectExtractor.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -137,22 +137,12 @@ private function extractModuleName($path)
137137
if ($path === "") {
138138
return "NO MODULE DETECTED";
139139
}
140-
$positions = [];
141-
$lastPos = 0;
142-
while (($lastPos = strpos($path, DIRECTORY_SEPARATOR, $lastPos))!== false) {
143-
$positions[] = $lastPos;
144-
$lastPos = $lastPos + strlen(DIRECTORY_SEPARATOR);
140+
$paths = explode(DIRECTORY_SEPARATOR, $path);
141+
if ($paths[count($paths)-3] == "Mftf") {
142+
// app/code/Magento/[Analytics]/Test/Mftf/Test/SomeText.xml
143+
return $paths[count($paths)-5];
145144
}
146-
$slashBeforeModule = $positions[count($positions)-3];
147-
$slashAfterModule = $positions[count($positions)-2];
148-
$output = substr($path, $slashBeforeModule+1, $slashAfterModule-$slashBeforeModule-1);
149-
150-
//Check if file was actually from app/code or vendor
151-
if ($output === "Mftf") {
152-
$slashBeforeModule = $positions[count($positions)-5];
153-
$slashAfterModule = $positions[count($positions)-4];
154-
$output = substr($path, $slashBeforeModule+1, $slashAfterModule-$slashBeforeModule-1);
155-
}
156-
return $output;
145+
// dev/tests/acceptance/tests/functional/Magento/FunctionalTest/[Analytics]/Test/SomeText.xml
146+
return $paths[count($paths)-3];
157147
}
158148
}

0 commit comments

Comments
 (0)