AmpersandHQ / magento2-disable-stock-reservation

This module disables the inventory reservation logic introduced as part of MSI in Magento 2.3.3
GNU Lesser General Public License v3.0
211 stars 60 forks source link

Check if getCanBackInStock #131

Closed robsoned closed 7 months ago

robsoned commented 8 months ago

Fix #126

convenient commented 8 months ago

Hey @robsoned

Not sure why the CI pipeline didn't trigger for you.

I've been reviewing this as well in https://github.com/AmpersandHQ/magento2-disable-stock-reservation/pull/128 , I believe in the magento inventory repo this may be handled by https://github.com/magento/inventory/commit/e0ff93dbd99c7c9a151cf71f8475641201301ebe

The tests I put together seems to suggest this works for some versions of Magento but not others, but is a promising start.

Screenshot 2023-11-07 at 09 19 58

robsoned commented 8 months ago

Hi @convenient

When was this test ran? Because I've confused the method isAutoReturnEnabled with getCanBackInStock. I've fixed yesterday.

image

I've run the tests on version 2.4.5, here is the result:

image

image

Maybe the test had not run yesterday, because I did not create a new commit, I committed with git commit -m '...' --amend.

convenient commented 7 months ago

Hey @robsoned

I have added some tests to your branch.

Without your code change the tests for all versions fail with The stock did stay at 0

1) Ampersand\DisableStockReservation\Test\Integration\Cancel\CancelOrderBackInStockConfigTest::testCancelOrderBackInStockDisabled
The stock did stay at 0
Failed asserting that 5.0 matches expected 0.
/current_extension/dev/MagentoTests/Integration/Cancel/CancelOrderBackInStockConfigTest.php:230

With your code change they're all green.