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 ObjectExtensionUtilTest (Complex!) #33305

Closed
sivaschenko opened this issue Jun 20, 2021 · 5 comments
Closed
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

sivaschenko commented Jun 20, 2021

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/Test/Util/ObjectExtensionUtilTest.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

@karyna-t
Copy link
Contributor

@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-320 is successfully created for this GitHub issue.

@bohdan-harniuk
Copy link
Contributor

@magento I am working on this

@andrewbess
Copy link

Pull request is merged in develop

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
Development

No branches or pull requests

6 participants