Skip to content

Commit 528387d

Browse files
authored
Merge pull request #244 from magento/MQE-1288
MQE-1288: ModuleResolver test paths are too greedy
2 parents 0a3ef3a + 3845479 commit 528387d

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@ public function testGetModulePathsLocations()
101101
// Define the Module paths from default TESTS_MODULE_PATH
102102
$modulePath = defined('TESTS_MODULE_PATH') ? TESTS_MODULE_PATH : TESTS_BP;
103103

104-
// Define the Module paths from vendor modules
105-
$projectRootCodePath = PROJECT_ROOT;
106-
107104
$mockResolver->verifyInvoked('globRelevantPaths', [$modulePath, '']);
108105
$mockResolver->verifyInvoked(
109106
'globRelevantPaths',
110-
[$magentoBaseCodePath, 'Test' . DIRECTORY_SEPARATOR .'Mftf']
107+
[$magentoBaseCodePath . DIRECTORY_SEPARATOR . "vendor" , 'Test' . DIRECTORY_SEPARATOR .'Mftf']
111108
);
112109
$mockResolver->verifyInvoked(
113110
'globRelevantPaths',
114-
[$projectRootCodePath, 'Test' . DIRECTORY_SEPARATOR .'Mftf']
111+
[
112+
$magentoBaseCodePath . DIRECTORY_SEPARATOR . "app" . DIRECTORY_SEPARATOR . "code",
113+
'Test' . DIRECTORY_SEPARATOR .'Mftf'
114+
]
115115
);
116116
}
117117

src/Magento/FunctionalTestingFramework/Test/Config/Dom.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ public function initDom($xml, $filename = null)
8888
{
8989
$dom = parent::initDom($xml, $filename);
9090

91-
if ($this->checkFilenameSuffix($filename, self::TEST_FILE_NAME_ENDING)) {
91+
// Cannot rely on filename to ensure this file is a Test.xml
92+
if ($dom->getElementsByTagName('tests')->length > 0) {
9293
$testsNode = $dom->getElementsByTagName('tests')[0];
9394
$testNodes = $dom->getElementsByTagName('test');
9495
$this->testsValidationUtil->validateChildUniqueness(

src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,13 @@ private function aggregateTestModulePaths()
240240
$modulePath = defined('TESTS_MODULE_PATH') ? TESTS_MODULE_PATH : TESTS_BP;
241241
$modulePath = rtrim($modulePath, DIRECTORY_SEPARATOR);
242242

243-
// Define the Module paths from project root
244-
$projectRootCodePath = PROJECT_ROOT;
243+
$vendorCodePath = DIRECTORY_SEPARATOR . "vendor";
244+
$appCodePath = DIRECTORY_SEPARATOR . "app" . DIRECTORY_SEPARATOR . "code";
245245

246246
$codePathsToPattern = [
247247
$modulePath => '',
248-
$magentoBaseCodePath => 'Test' . DIRECTORY_SEPARATOR . 'Mftf',
249-
$projectRootCodePath => 'Test' . DIRECTORY_SEPARATOR . 'Mftf'
248+
$magentoBaseCodePath . $vendorCodePath => 'Test' . DIRECTORY_SEPARATOR . 'Mftf',
249+
$magentoBaseCodePath . $appCodePath => 'Test' . DIRECTORY_SEPARATOR . 'Mftf'
250250
];
251251

252252
foreach ($codePathsToPattern as $codePath => $pattern) {

0 commit comments

Comments
 (0)