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

Cleanup ObjectManager usage - Magento_Catalog ViewModel,Plugin #27319

Conversation

Bartlomiejsz
Copy link
Contributor

@Bartlomiejsz Bartlomiejsz commented Mar 17, 2020

Description (*)

This PR cleanups ObjectManager usage in Magento_Catalog ViewModel and Plugin, by removing object manager instantiation from non-api classes. This is first part of #27135 split into smaller chunks to proceed it easily.

Related Pull Requests

Fixed Issues (if relevant)

N/A

Manual testing scenarios (*)

Questions or comments

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/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Mar 17, 2020

Hi @Bartlomiejsz. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

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

Copy link
Contributor

@lbajsarowicz lbajsarowicz left a comment

Choose a reason for hiding this comment

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

Correct the tested class names (avoid generic aliases).
Add 'mock' suffix to mocked properties in unit tests.


namespace Magento\Catalog\Test\Unit\Plugin\Model\ResourceModel;

use Magento\Catalog\Model\ResourceModel\Config as Subject;
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using subject as it's misleading.
Use ConfigResourceModel instead

/** @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject */
/**
* @var SerializerInterface|MockObject
*/
private $serializer;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suffix with 'mock'

@ghost ghost assigned lbajsarowicz Mar 18, 2020
@ihor-sviziev ihor-sviziev removed their request for review March 18, 2020 05:24
@Bartlomiejsz Bartlomiejsz force-pushed the feature/objectmanager_cleanup_catalog_1 branch from efbbb9f to d634cac Compare March 18, 2020 07:22
@Bartlomiejsz
Copy link
Contributor Author

@lbajsarowicz applied fixes for review comments, please review

Copy link
Contributor

@lbajsarowicz lbajsarowicz left a comment

Choose a reason for hiding this comment

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

✔️ Thank you for your contribution

@magento-engcom-team
Copy link
Contributor

Hi @lbajsarowicz, thank you for the review.
ENGCOM-7139 has been created to process this Pull Request
✳️ @lbajsarowicz, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@engcom-Alfa engcom-Alfa self-assigned this Mar 18, 2020
@engcom-Alfa engcom-Alfa added the Auto-Tests: Covered All changes in Pull Request is covered by auto-tests label Mar 18, 2020
@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

@engcom-Echo
Copy link
Contributor

@magento run Functional Tests EE

@engcom-Echo engcom-Echo self-assigned this Mar 23, 2020
@m2-assistant
Copy link

m2-assistant bot commented Mar 25, 2020

Hi @Bartlomiejsz, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@Bartlomiejsz Bartlomiejsz deleted the feature/objectmanager_cleanup_catalog_1 branch June 23, 2020 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Component: Catalog Partner: Fast White Cat partners-contribution Pull Request is created by Magento Partner Progress: accept Release Line: 2.4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants