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] Replace AspectMock with PHPUnit for FilesystemTest #33291

Closed
sivaschenko opened this issue Jun 20, 2021 · 1 comment · Fixed by magento/magento2-functional-testing-framework#833
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

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

Replace AspectMock with PHPUnit for dev/tests/unit/Magento/FunctionalTestFramework/Config/Reader/FilesystemTest.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

@sivaschenko sivaschenko added Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Project: Platform Health labels Jun 20, 2021
@sivaschenko sivaschenko self-assigned this Jun 20, 2021
@m2-assistant
Copy link

m2-assistant bot commented Jun 20, 2021

Hi @sivaschenko. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

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

Successfully merging a pull request may close this issue.

1 participant