From dda214e8f95c2755388de02dbc3629f4ce040634 Mon Sep 17 00:00:00 2001 From: Alex Calandra Date: Thu, 4 Oct 2018 14:26:11 -0500 Subject: [PATCH 1/3] MQE-1288: ModuleResolver test paths are too greedy - Specify to onnly look under app and vendor for magento bp - Removed Project root from list of search areas --- .../Util/ModuleResolverTest.php | 10 +++++----- .../FunctionalTestingFramework/Util/ModuleResolver.php | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php index 6a407eded..356a8598e 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php @@ -101,17 +101,17 @@ public function testGetModulePathsLocations() // Define the Module paths from default TESTS_MODULE_PATH $modulePath = defined('TESTS_MODULE_PATH') ? TESTS_MODULE_PATH : TESTS_BP; - // Define the Module paths from vendor modules - $projectRootCodePath = PROJECT_ROOT; - $mockResolver->verifyInvoked('globRelevantPaths', [$modulePath, '']); $mockResolver->verifyInvoked( 'globRelevantPaths', - [$magentoBaseCodePath, 'Test' . DIRECTORY_SEPARATOR .'Mftf'] + [$magentoBaseCodePath . DIRECTORY_SEPARATOR . "vendor" , 'Test' . DIRECTORY_SEPARATOR .'Mftf'] ); $mockResolver->verifyInvoked( 'globRelevantPaths', - [$projectRootCodePath, 'Test' . DIRECTORY_SEPARATOR .'Mftf'] + [ + $magentoBaseCodePath . DIRECTORY_SEPARATOR . "app" . DIRECTORY_SEPARATOR . "code", + 'Test' . DIRECTORY_SEPARATOR .'Mftf' + ] ); } diff --git a/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php b/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php index b2e1d32a2..1f003ec1f 100644 --- a/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php +++ b/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php @@ -240,13 +240,14 @@ private function aggregateTestModulePaths() $modulePath = defined('TESTS_MODULE_PATH') ? TESTS_MODULE_PATH : TESTS_BP; $modulePath = rtrim($modulePath, DIRECTORY_SEPARATOR); - // Define the Module paths from project root - $projectRootCodePath = PROJECT_ROOT; + $vendorCodePath = DIRECTORY_SEPARATOR . "vendor"; + $appCodePath = DIRECTORY_SEPARATOR . "app" . DIRECTORY_SEPARATOR . "code"; $codePathsToPattern = [ $modulePath => '', - $magentoBaseCodePath => 'Test' . DIRECTORY_SEPARATOR . 'Mftf', - $projectRootCodePath => 'Test' . DIRECTORY_SEPARATOR . 'Mftf' + $magentoBaseCodePath . $vendorCodePath => 'Test' . DIRECTORY_SEPARATOR . 'Mftf', + $magentoBaseCodePath . $appCodePath => 'Test' . DIRECTORY_SEPARATOR . 'Mftf', + ]; foreach ($codePathsToPattern as $codePath => $pattern) { From 17fd97b94ed0485216451cc05c21f79b81854cd0 Mon Sep 17 00:00:00 2001 From: Alex Calandra Date: Thu, 4 Oct 2018 14:30:37 -0500 Subject: [PATCH 2/3] MQE-1288: ModuleResolver test paths are too greedy - Fixed Empty space and unused comma --- src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php b/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php index 1f003ec1f..cfe59bd38 100644 --- a/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php +++ b/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php @@ -246,8 +246,7 @@ private function aggregateTestModulePaths() $codePathsToPattern = [ $modulePath => '', $magentoBaseCodePath . $vendorCodePath => 'Test' . DIRECTORY_SEPARATOR . 'Mftf', - $magentoBaseCodePath . $appCodePath => 'Test' . DIRECTORY_SEPARATOR . 'Mftf', - + $magentoBaseCodePath . $appCodePath => 'Test' . DIRECTORY_SEPARATOR . 'Mftf' ]; foreach ($codePathsToPattern as $codePath => $pattern) { From 3845479cbe58f5150c12ee7d82c3f10251e36d9a Mon Sep 17 00:00:00 2001 From: Kevin Kozan Date: Fri, 5 Oct 2018 08:32:53 -0500 Subject: [PATCH 3/3] MQE-1288: ModuleResolver test paths are too greedy - test dom.php fix for filename --- src/Magento/FunctionalTestingFramework/Test/Config/Dom.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/Test/Config/Dom.php b/src/Magento/FunctionalTestingFramework/Test/Config/Dom.php index c13e8f056..12127ef32 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Config/Dom.php +++ b/src/Magento/FunctionalTestingFramework/Test/Config/Dom.php @@ -88,7 +88,8 @@ public function initDom($xml, $filename = null) { $dom = parent::initDom($xml, $filename); - if ($this->checkFilenameSuffix($filename, self::TEST_FILE_NAME_ENDING)) { + // Cannot rely on filename to ensure this file is a Test.xml + if ($dom->getElementsByTagName('tests')->length > 0) { $testsNode = $dom->getElementsByTagName('tests')[0]; $testNodes = $dom->getElementsByTagName('test'); $this->testsValidationUtil->validateChildUniqueness(