Skip to content

Eliminated Aspect Mock usage from ActionMergeUtilTest #837

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

Conversation

vlmed
Copy link
Contributor

@vlmed vlmed commented Jun 23, 2021

Description

This PR will pass all tests after related PR will be merged

Eliminated Aspect Mock usage from ActionMergeUtilTest: dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php

Related Pull Requests

#849

Fixed Issues (if relevant)

  1. [MFTF] Replace AspectMock with PHPUnit for ActionMergeUtilTest magento2#33304: [MFTF] Replace AspectMock with PHPUnit for ActionMergeUtilTest

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-engcom-team magento-engcom-team added Partner: Atwix partners-contribution Pull Request is created by Magento Partner labels Jun 23, 2021
@vlmed vlmed force-pushed the remove/aspect-mock-33304 branch from 85fb8c2 to 135fdf9 Compare June 23, 2021 13:18
@vlmed vlmed closed this Jun 23, 2021
@sivaschenko
Copy link
Member

@vlmed was this PR closed intentionally?

@vlmed
Copy link
Contributor Author

vlmed commented Jul 1, 2021

@sivaschenko. Yes i closed this PR. When I run only this test, it passes without errors, if I run with all the tests, it does not pass. The reason is in AspectMock::double(DataObjectHandler::class, ['getInstance' => $mockDOHInstance]); static method. Looks like if we fully remove AspectMock from project my changes in the test should work. I can reopen PR if this changes is correct

@sivaschenko
Copy link
Member

Got it, thanks @vlmed . I will add your PR to the issue description and unassign you from the issue

@bohdan-harniuk
Copy link
Contributor

Hello, @jilu1

I have a little bit helped for @vlmed with the aspect mock elimination here. Now all tests run fine.

The problem was that AspectMock mocked the getInstance method of the DataObjectHandler class. In this test, we set mock to the INSTANCE variable through the ReflectionProperty. But we got the wrong mock instance, mocked by the AspectMock (the INSTANCE variable checked in the getInstance method...getInstance method mocked by the AspectMock and that mocked object returned before our mock on the INSTANCE variable).

cc: @vlmed , @sivaschenko

Copy link
Contributor

@bohdan-harniuk bohdan-harniuk left a comment

Choose a reason for hiding this comment

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

It is fine for me. @vlmed, thank you for your contribution.

@jilu1, could you please take a look at this PR too?

Copy link
Contributor

@andrewbess andrewbess left a comment

Choose a reason for hiding this comment

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

Hello @vlmed
Thank you for your contribution.
Hello @bohdan-harniuk
Thank you for your helping @vlmed
The changes look great for me.

@bohdan-harniuk
Copy link
Contributor

Hello, @jilu1

This task was finished without creating new singletons, so it is not a blocker. You can proceed with the code review.

Thanks, Bohdan

@jilu1
Copy link
Contributor

jilu1 commented Jul 28, 2021

@magento-engcom-team
Copy link

@jilu1 the pull request successfully imported.

@magento-devops-reposync-svc magento-devops-reposync-svc merged commit 9c9539f into magento:develop Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accept Partner: Atwix partners-contribution Pull Request is created by Magento Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants