Skip to content

33309: Eliminated AspectMock usage from TestGeneratorTest.php #850

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

Conversation

anzin
Copy link
Contributor

@anzin anzin commented Jul 6, 2021

Description

I've eliminated AspectMock usage from
dev/tests/unit/Magento/FunctionalTestFramework/Util/TestGeneratorTest.php.

Fixed Issues (if relevant)

  1. Fixes [MFTF] Eliminate AspectMock from TestGeneratorTest (Complex!) magento2#33309: [MFTF] Eliminate AspectMock from TestGeneratorTest (Complex!)

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

andrewbess
andrewbess previously approved these changes Jul 20, 2021
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 @anzin
Thank you for your contribution.
It looks well for me.

@andrewbess andrewbess requested a review from jilu1 July 20, 2021 15:43
@bohdan-harniuk bohdan-harniuk added Partner: Atwix partners-contribution Pull Request is created by Magento Partner labels Jul 21, 2021
@jilu1
Copy link
Contributor

jilu1 commented Jul 22, 2021

@magento-engcom-team
Copy link

@jilu1 the pull request successfully imported.

@andrewbess andrewbess self-assigned this Jul 22, 2021
@jilu1
Copy link
Contributor

jilu1 commented Jul 22, 2021

@anzin
Thank You for your PR! Please address unit test failures in TestGeneratorTest.

@bohdan-harniuk bohdan-harniuk self-requested a review July 22, 2021 15:09
@bohdan-harniuk bohdan-harniuk force-pushed the improvement/mftf-33309-eliminate-aspect-mock-from-test-generator-test branch from 0721011 to 6ab27e6 Compare July 22, 2021 15:33
@bohdan-harniuk bohdan-harniuk force-pushed the improvement/mftf-33309-eliminate-aspect-mock-from-test-generator-test branch from 6ab27e6 to 43f9436 Compare July 22, 2021 15:35
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.

Hello, @anzin!
Good job! Thank you for your contribution!

Hello, @jilu1!
Could you please check everything here? I've refactored the code a little bit. Now all tests passed successfully!

Thanks, Bohdan

@jilu1
Copy link
Contributor

jilu1 commented Jul 23, 2021

@magento-engcom-team
Copy link

@jilu1 the pull request successfully imported.

* @return void
* @throws TestFrameworkException
*/
public function create(string $filename, string $exportDirectory, string $testPhp): void
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the idea of pulling some code out of TestGenerator, but I don't think that creating a singleton that hold no data for a single utility function makes sense.

I would sooner that they change the visibility of createCestFile to public and mock that method instead. This is a lot of code to introduce to mock a single method.

Copy link
Contributor

@bohdan-harniuk bohdan-harniuk Jul 29, 2021

Choose a reason for hiding this comment

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

@KevinBKozan, as for me, in general, the composition is much better than big classes with a variety of functions.
@jilu1, what do you think about that concrete case?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@bohdan-harniuk Yeah, I see your point in that. I'm just vigilant about creating any classes that will perpetually live in memory, but I suppose that's not much of a concern if there's not a large amount of data being held.

I'm happy to defer to @jilu1 's original review in this case, I'll approve this and we can merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MFTF] Eliminate AspectMock from TestGeneratorTest (Complex!)
7 participants