-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[CatalogInventory] Covering the InvalidatePriceIndexUponConfigChangeObserver for Catalog… #26150
[CatalogInventory] Covering the InvalidatePriceIndexUponConfigChangeObserver for Catalog… #26150
Conversation
…Inventory by Unit Test
Hi @eduard13. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job. Thank you for your contribution.
$this->observerMock->expects($this->once()) | ||
->method('getEvent') | ||
->willReturn($this->eventMock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if the expecting single execution of getEvent
is critical.
When implementation is changed and extra behaviour is added, then this test would fail - even if the functionality covered by tour test has not changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with you, but in the same time, why should we call getEvent twice instead of storing it into a variable (have it used only once) and use it whenever we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why I approved PR, because it's not so easy to decide what's the correct approach.
$this->observerMock->expects($this->once()) | ||
->method('getEvent') | ||
->willReturn($this->eventMock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if the expecting single execution of getEvent is critical.
When implementation is changed and extra behaviour is added, then this test would fail - even if the functionality covered by tour test has not changed.
Hi @lbajsarowicz, thank you for the review.
|
QA not applicable |
…ConfigChangeObserver for Catalog… #26150
Hi @eduard13, thank you for your contribution! |
…Inventory by Unit Test
Description (*)
This PR adds missing unit tests for the following class:
\Magento\CatalogInventory\Observer\InvalidatePriceIndexUponConfigChangeObserver
Fixed Issues (if relevant)
N/A
Manual testing scenarios (*)
N/A
Questions or comments
Contribution checklist (*)