Cover the source-mode gate on composite parent stock status - #3467
Open
brosenberger wants to merge 1 commit into
Open
brosenberger wants to merge 1 commit into
brosenberger wants to merge 1 commit into
Conversation
…atus Adds a regression guard for magento#3350 and unit coverage of the plugin that carries the gate. Both pass against develop unchanged; no production code is touched. CompositeParentSalabilityOnNonDefaultStockTest puts a configurable's children out of stock on the default source only, while the sources backing a non-default stock still hold stock, and asserts the parent stays salable in that stock. There is no regression guard for magento#3350 today, and the behaviour is easy to break: the test fails as soon as the IsSingleSourceMode gate on the composite parent recompute is removed. UpdateCompositeProductStockStatusOnSourceItemsSaveTest documents the gate itself - the recompute runs in single source mode and is skipped in multi source mode - so that the reason for the gate is visible next to the code rather than only in the issue history.
Open
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description (*)
Adds test coverage for the source-mode gate on the composite parent stock status recompute. No production code is changed, and both tests pass against
developunchanged.InventoryCatalog/Test/Integration/CompositeParentSalabilityOnNonDefaultStockTestis a regression guard for #3350. It puts a configurable's children out of stock on thedefaultsource only, while theeusources backing stock10still hold stock, and asserts the parent stays salable in that stock. There is no guard for this today, and the behaviour is easy to break by accident: the test fails as soon as theIsSingleSourceModegate on the composite parent recompute is removed.InventoryCatalog/Test/Unit/Plugin/InventoryApi/UpdateCompositeProductStockStatusOnSourceItemsSaveTestdocuments the gate itself — the recompute runs in single source mode and is deliberately skipped in multi source mode — so the reason for the gate sits next to the code rather than only in issue history. That plugin has no unit coverage today.I wrote these while investigating whether the gate could be lifted so composite parents are maintained in multi source mode. It cannot, at least not without a design decision; the evidence is in #3466. These tests are the part of that work that is useful on its own.
Fixed Issues (if relevant)
Manual testing scenarios (*)
developwith no other changes and run both tests. They pass:if ($this->isSingleSourceMode->execute())wrapper inInventoryCatalog/Plugin/InventoryApi/UpdateCompositeProductStockStatusOnSourceItemsSave::afterExecute()and re-run the integration test. It fails with the parent no longer salable in stock 10, which is Configurable products marked out of stock incorrectly #3350.Note that the MSI integration tests are not picked up by the default integration suite, which globs
testsuiteandapp/code/*/*/Test/Integration, so the path has to be passed explicitly.Questions or comments
The unit test asserts the current gated behaviour rather than a desired behaviour, on purpose. If the outcome of #3466 is that composite parents should be maintained in multi source mode, that test is the one to update, and it will say clearly what changed.
Contribution checklist (*)