Skip to content

MQE-1124: [Github Issue] Allow running tests for modules installed in… #228

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 7 commits into from
Sep 25, 2018

Conversation

aljcalandra
Copy link
Contributor

@aljcalandra aljcalandra commented Sep 19, 2018

… Magento instance via vendor directory. #162

  • Adjusted Module Resolver to look Recursively from Project Root, Magento BP and dev/tests
  • Updated Module Resolver Unit Tests to reflect changes

Adjusted ModuleResolver to do a recursive search in directories related to PROJECT_ROOT and MAGENTO_BP

Fixed Issues (if relevant)

  1. magento/magento2-functional-testing-framework#<162>: Allow running tests for modules installed in Magento instance via vendor directory.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/verification tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)
  • Changes to Framework doesn't have backward incompatible changes for tests or have related Pull Request with fixes to tests

… Magento instance via vendor directory. #162

- Adjusted Module Resolver to look Recursively from Project Root, Magento BP and dev/tests
- Updated Module Resolver Unit Tests to reflect changes
… Magento instance via vendor directory. #162

- Reintroduced recursive_merge to prevent similar directories with different contents being missed
@coveralls
Copy link

Coverage Status

Coverage increased (+0.008%) to 57.406% when pulling 5ac6b56 on MQE-1124 into 66b6ecd on develop.

@coveralls
Copy link

coveralls commented Sep 19, 2018

Coverage Status

Coverage decreased (-0.02%) to 57.376% when pulling f63cd84 on MQE-1124 into 10a269e on develop.

Copy link
Contributor

@KevinBKozan KevinBKozan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to a great job of finding the paths, but there are matching problems (I'm sure you know about this from in person conversation though).

foreach (glob($testPath . $subDirectory, GLOB_ONLYDIR) as $dir) {
$directories = array_merge_recursive($directories, self::globRelevantWrapper($dir, $pattern));
}
return $directories;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These directory changes seem to pick up modules under vendor just fine, but consider the following:
I have pulled CE 2.2.6 and attempted to generate tests, the following path is directory is found by this glob:
/Users/kkozan/Documents/TestPull/magento2ce/vendor/magento/module-catalog/Test/Mftf
The function GlobRelevantPaths assigns the above path to an index based on the module it found (which is found via the pattern given, leaving the path under module-catalog.

This is going to fail to map to the module returned by our ping to Magento, Magento_Catalog.
We need to find a way to map module-* to Magento_* manually or hopefully from the magento instance itself.

… Magento instance via vendor directory.

- Updated to include checking through registered Magento modules
… Magento instance via vendor directory.

- Used class constant instead of just adding it
Copy link
Contributor

@KevinBKozan KevinBKozan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback from in-person testing.

@@ -265,7 +270,8 @@ private function globRelevantPaths($testPath, $pattern)
}

foreach ($relevantPaths as $codePath) {
$mainModName = basename(str_replace($pattern, '', $codePath));
$allComponents = $this->getRegisteredModuleList();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to do two things here:

  • Strip /Test/Mftf off end of codepath
  • Assign to $modulePaths according to $allComponents value match (Magento_Store -> Store) to match module list

/**
* List of path types present in Magento Component Registrar
*/
const PATHS = ['module', 'library', 'theme', 'language', 'setup'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to remove setup from PATHS.

/**
* Magento Registrar Class
*/
const REGISTRAR_CLASS = "\Magento\Framework\Component\Registrar";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class should be \Magento\Framework\Component\ComponentRegistrar

… Magento instance via vendor directory.

- Adding requested changes
… Magento instance via vendor directory.

- Specified additional error in case of bad Magento basepath
@KevinBKozan
Copy link
Contributor

@aljcalandra I'm going to triple check the last bit of changes against a git-pull installation of Magento, I'll let you know the results.

@KevinBKozan
Copy link
Contributor

@aljcalandra tested against git-pull Magento, double checked parsed test counts before/after. We are good to go here!

@aljcalandra aljcalandra merged commit 54a61f8 into develop Sep 25, 2018
@aljcalandra aljcalandra deleted the MQE-1124 branch September 25, 2018 14:44
@aljcalandra
Copy link
Contributor Author

Resolved /issues/162

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants