-
Notifications
You must be signed in to change notification settings - Fork 131
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
33308: Eliminated AspectMock usage from ModuleResolverTest.php #852
33308: Eliminated AspectMock usage from ModuleResolverTest.php #852
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @anzin
Thank you for your job.
…ock-from-module-resolver-test
@magento import pull request to https://github.com/magento-commerce/magento2-functional-testing-framework |
@jilu1 the pull request successfully imported. |
@anzin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@magento import pull request to https://github.com/magento-commerce/magento2-functional-testing-framework |
@jilu1 the pull request successfully imported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anzin @bohdan-harniuk
Can we make sure to have the removed unit tests added back in for the new ModuleResolverService
?
For example, testAggregateTestModulePathsDevTests
, testGetModulePathsLocations
, testGetComposerJsonTestModulePathsForPathInvocation
, testGetComposerInstalledTestModulePathsForPathInvocation
, etc
Hello @jilu1 , sorry I don't understand your question. I removed these tests because we eliminate AspectMock, and these tests are not necessary, or I misunderstood something? Thank you. |
@anzin Can you explain why these tests are not necessary? In other words, should you add these |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @anzin
Thank you for your contribution.
Good job.
$moduleResolverService = $this->createPartialMock(ModuleResolverService::class, ['globRelevantPaths']); | ||
$moduleResolverService | ||
->method('globRelevantPaths') | ||
->withConsecutive() | ||
->will( | ||
$this->returnCallback( | ||
function ($codePath, $pattern) use ($modulePath, $magentoBaseCodePath) { | ||
if ($codePath === $modulePath && $pattern === '') { | ||
return []; | ||
} | ||
|
||
if ($codePath === $magentoBaseCodePath . '/vendor' && $pattern === 'Test/Mftf') { | ||
return []; | ||
} | ||
|
||
if ($codePath === $magentoBaseCodePath . "/app/code" && $pattern === 'Test/Mftf') { | ||
return []; | ||
} | ||
|
||
$this->fail(sprintf( | ||
'Not expected parameter: \'%s\' when invoked method globRelevantPaths().', | ||
$modulePath | ||
)); | ||
} | ||
) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anzin
This is close but does not match exactly what the original test does. The original test makes sure that all the paths parameters are used at least once, but the new test will miss that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All look good except one comment. Please check.
5cf7039
to
3a1ae0d
Compare
Hello @jilu1 , I've fixed test 'testGetModulePathsLocations', please check if everything is well. Thanks. |
@magento import pull request to https://github.com/magento-commerce/magento2-functional-testing-framework |
@jilu1 the pull request successfully imported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anzin, thank you for your work here!
…ing-framework into improvement/mftf-33308-eliminate-aspect-mock-from-module-resolver-test
89812a2
3a1ae0d
to
89812a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @jilu1!
I've actualised and fixed this PR.
Could you please proceed with the code review and check everything?
Thanks, Bohdan
Description
I've eliminated AspectMock usage from
dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php
Fixed Issues (if relevant)
Contribution checklist