diff --git a/src/Sylius/Component/Core/Inventory/Exception/NotEnoughUnitsOnHandException.php b/src/Sylius/Component/Core/Inventory/Exception/NotEnoughUnitsOnHandException.php index aaf55ba1eeb..66ed8d878c8 100644 --- a/src/Sylius/Component/Core/Inventory/Exception/NotEnoughUnitsOnHandException.php +++ b/src/Sylius/Component/Core/Inventory/Exception/NotEnoughUnitsOnHandException.php @@ -13,7 +13,7 @@ namespace Sylius\Component\Core\Inventory\Exception; -final class NotEnoughUnitsOnHandException extends \InvalidArgumentException +final class NotEnoughUnitsOnHandException extends \RuntimeException { public function __construct(string $variantName) { diff --git a/src/Sylius/Component/Core/Inventory/Exception/NotEnoughUnitsOnHoldException.php b/src/Sylius/Component/Core/Inventory/Exception/NotEnoughUnitsOnHoldException.php index a144f7f9a9e..807a0786e44 100644 --- a/src/Sylius/Component/Core/Inventory/Exception/NotEnoughUnitsOnHoldException.php +++ b/src/Sylius/Component/Core/Inventory/Exception/NotEnoughUnitsOnHoldException.php @@ -13,7 +13,7 @@ namespace Sylius\Component\Core\Inventory\Exception; -final class NotEnoughUnitsOnHoldException extends \InvalidArgumentException +final class NotEnoughUnitsOnHoldException extends \RuntimeException { public function __construct(string $variantName) { diff --git a/src/Sylius/Component/Core/spec/Inventory/Operator/OrderInventoryOperatorSpec.php b/src/Sylius/Component/Core/spec/Inventory/Operator/OrderInventoryOperatorSpec.php index fa897d3cb27..4f875835841 100644 --- a/src/Sylius/Component/Core/spec/Inventory/Operator/OrderInventoryOperatorSpec.php +++ b/src/Sylius/Component/Core/spec/Inventory/Operator/OrderInventoryOperatorSpec.php @@ -16,6 +16,8 @@ use Doctrine\Common\Collections\ArrayCollection; use PhpSpec\ObjectBehavior; use Prophecy\Argument; +use Sylius\Component\Core\Inventory\Exception\NotEnoughUnitsOnHandException; +use Sylius\Component\Core\Inventory\Exception\NotEnoughUnitsOnHoldException; use Sylius\Component\Core\Inventory\Operator\OrderInventoryOperatorInterface; use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Model\OrderItemInterface; @@ -123,7 +125,7 @@ function it_increases_on_hand_during_cancelling_of_a_refunded_order( $this->cancel($order); } - function it_throws_an_invalid_argument_exception_if_difference_between_on_hold_and_item_quantity_is_smaller_than_zero_during_cancelling( + function it_throws_a_not_enough_units_on_hold_exception_if_difference_between_on_hold_and_item_quantity_is_smaller_than_zero_during_cancelling( OrderInterface $order, OrderItemInterface $orderItem, ProductVariantInterface $variant, @@ -139,10 +141,10 @@ function it_throws_an_invalid_argument_exception_if_difference_between_on_hold_a $variant->getName()->willReturn('Red Skirt'); - $this->shouldThrow(\InvalidArgumentException::class)->during('cancel', [$order]); + $this->shouldThrow(NotEnoughUnitsOnHoldException::class)->during('cancel', [$order]); } - function it_throws_an_invalid_argument_exception_if_difference_between_on_hold_and_item_quantity_is_smaller_than_zero_during_selling( + function it_throws_a_not_enough_units_on_hold_exception_if_difference_between_on_hold_and_item_quantity_is_smaller_than_zero_during_selling( OrderInterface $order, OrderItemInterface $orderItem, ProductVariantInterface $variant, @@ -156,10 +158,10 @@ function it_throws_an_invalid_argument_exception_if_difference_between_on_hold_a $variant->getName()->willReturn('Red Skirt'); - $this->shouldThrow(\InvalidArgumentException::class)->during('sell', [$order]); + $this->shouldThrow(NotEnoughUnitsOnHoldException::class)->during('sell', [$order]); } - function it_throws_an_invalid_argument_exception_if_difference_between_on_hand_and_item_quantity_is_smaller_than_zero_during_selling( + function it_throws_a_not_enough_units_on_hand_exception_if_difference_between_on_hand_and_item_quantity_is_smaller_than_zero_during_selling( OrderInterface $order, OrderItemInterface $orderItem, ProductVariantInterface $variant, @@ -174,7 +176,7 @@ function it_throws_an_invalid_argument_exception_if_difference_between_on_hand_a $variant->getName()->willReturn('Red Skirt'); - $this->shouldThrow(\InvalidArgumentException::class)->during('sell', [$order]); + $this->shouldThrow(NotEnoughUnitsOnHandException::class)->during('sell', [$order]); } function it_does_nothing_if_variant_is_not_tracked_during_cancelling(