Skip to content
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

[MFTF] Eliminate AspectMock from ModuleResolverTest (Complex!) #33308

Closed
sivaschenko opened this issue Jun 20, 2021 · 5 comments · Fixed by magento/magento2-functional-testing-framework#852
Assignees
Labels
Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Project: PHP8 Project: Platform Health

Comments

@sivaschenko
Copy link
Member

This task is tricky and requires investigation on the approach to mock static calls without Aspect Mock

Goal

codeception/aspect-mock library is still not compatible with PHP 8.0 at the time of the creation of this ticket.

To speed up Magento compatibility with new PHP versions we'd like to eliminate codeception/aspect-mock dependency from MFTF. This will make MFTF compatible with PHP 8.0 that is required for declaring the Magento core PHP 8 compatible as well.

In order to do this existing unit tests using AspectMock should be refactored to use PHPUnit instead.

Task

Eliminate AspectMock usage from dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php in https://github.com/magento/magento2-functional-testing-framework repository.

Example

Mocking an object using AspectMock (current):

        $mock = AspectMock::double(
            MockedClass::class,
            [
                'mockedMethodName' => 'methodReturnValue',
            ]
        )->make();

Mocking an object using PHPUnit (refactored code):

        $mock = $this->createMock(File::class);
        $file->expects($this->any())
            ->method('mockedMethodName')
            ->willReturn('methodReturnValue');

Example pull request: magento/magento2-functional-testing-framework#833

@m2-assistant
Copy link

m2-assistant bot commented Jun 20, 2021

Hi @sivaschenko. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@SilinMykola
Copy link
Contributor

@magento I am working on this

@SilinMykola SilinMykola removed their assignment Jun 28, 2021
@sivaschenko sivaschenko added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Jun 28, 2021
@anzin
Copy link
Contributor

anzin commented Jun 30, 2021

@magento I am working on this

@sivaschenko
Copy link
Member Author

@magento export issue to Jira project AC as Story

@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.magento.com/browse/AC-307 is successfully created for this GitHub issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Project: PHP8 Project: Platform Health
Projects
None yet
4 participants