Skip to content

MQE-1288: ModuleResolver test paths are too greedy #244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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'
]
);
}

Expand Down
3 changes: 2 additions & 1 deletion src/Magento/FunctionalTestingFramework/Test/Config/Dom.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,13 @@ 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) {
Expand Down