Extend the graceful catch (NoSuchEntityException $noSuchEntityException to cover the whole inner for loop.
Allow you to cancel orders when theres no order_sources data available.
The test was added and failed with
There was 1 error:
1) Ampersand\DisableStockReservation\Test\Integration\Cancel\CancelOrderWithMissingOrderSourcesTest::testCancelOrderWithMissingOrderSources
Magento\Framework\Exception\NoSuchEntityException: Source model with the order ID "3" does not exist
/current_extension/src/Model/SourcesRepository.php:72
/current_extension/src/Model/SourcesRepository.php:88
/current_extension/src/Service/ExecuteSourceDeductionForItems.php:144
/current_extension/src/Observer/CancelOrderItemObserver.php:55
/var/www/html/vendor/magento/framework/Event/Invoker/InvokerDefault.php:88
/var/www/html/vendor/magento/framework/Event/Invoker/InvokerDefault.php:74
/var/www/html/vendor/magento/framework/Event/Manager.php:65
/var/www/html/generated/code/Magento/Framework/Event/Manager/Proxy.php:95
/var/www/html/vendor/magento/module-sales/Model/Order/Item.php:410
/var/www/html/generated/code/Magento/Sales/Model/Order/Item/Interceptor.php:149
/var/www/html/vendor/magento/module-sales/Model/Order.php:1319
/var/www/html/generated/code/Magento/Sales/Model/Order/Interceptor.php:401
/var/www/html/vendor/magento/module-sales/Model/Order.php:1279
/var/www/html/generated/code/Magento/Sales/Model/Order/Interceptor.php:383
/current_extension/dev/MagentoTests/Integration/Cancel/CancelOrderWithMissingOrderSourcesTest.php:98
/var/www/html/vendor/bin/phpunit:123
Checklist
[x] Pull request has a meaningful description of its purpose, include affected Magento versions if it is a bug.
[x] All commits are accompanied by meaningful commit messages
[x] Tests have been ran / updated (see ./dev/README.md for how to run tests)
Extend the graceful
catch (NoSuchEntityException $noSuchEntityException
to cover the whole inner for loop.Allow you to cancel orders when theres no
order_sources
data available.The test was added and failed with
Checklist
./dev/README.md
for how to run tests)