From 583bf7f4f95b166da54b7951cf28557c1c427dc4 Mon Sep 17 00:00:00 2001 From: Mateusz Zalewski Date: Tue, 8 Jun 2021 11:18:32 +0200 Subject: [PATCH] UPGRADE informations and final fixes --- UPGRADE.md | 10 ++++++++++ spec/Creator/RefundCreatorSpec.php | 12 ++++++------ src/Checker/OrderFullyRefundedTotalChecker.php | 1 - src/Entity/Refund.php | 2 +- src/Entity/RefundInterface.php | 2 +- src/Migrations/Version20210608074013.php | 9 +++++++++ src/Twig/OrderRefundsExtension.php | 1 - 7 files changed, 27 insertions(+), 10 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 7744519a9..713b9c70e 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,3 +1,13 @@ +### UPGRADE FROM 1.0.0-RC.10 TO 1.0.0-RC.11 + +1. `orderNumber` field on `Sylius\RefundPlugin\Entity\Refund` has been removed and replaced with relation to `Order` entity. +1. `Sylius\RefundPlugin\Entity\RefundInterface::getOrderNumber` function is left due to easier and smoother upgrades, + but is also deprecated and will be removed in the `v1.0.0` release. Use `Sylius\RefundPlugin\Entity\RefundInterface::getOrder` instead. +1. `Sylius\RefundPlugin\Creator\RefundCreator` takes `\Sylius\Component\Core\Repository\OrderRepositoryInterface` + as the 3rd argument. +1. `Sylius\RefundPlugin\Provider\OrderRefundedTotalProviderInterface::invoke` takes `OrderInterface $order` as an argument + instead of `string $orderNumber` + ### UPGRADE FROM 1.0.0-RC.9 TO 1.0.0-RC.10 1. Support for Sylius 1.8 has been dropped, upgrade your application to [Sylius 1.9](https://github.com/Sylius/Sylius/blob/master/UPGRADE-1.9.md) diff --git a/spec/Creator/RefundCreatorSpec.php b/spec/Creator/RefundCreatorSpec.php index a6c51ad91..f28e2e994 100644 --- a/spec/Creator/RefundCreatorSpec.php +++ b/spec/Creator/RefundCreatorSpec.php @@ -26,7 +26,7 @@ final class RefundCreatorSpec extends ObjectBehavior { - function let( + public function let( RefundFactoryInterface $refundFactory, RemainingTotalProviderInterface $remainingTotalProvider, OrderRepositoryInterface $orderRepository, @@ -40,12 +40,12 @@ function let( ); } - function it_implements_refund_creator_interface(): void + public function it_implements_refund_creator_interface(): void { $this->shouldImplement(RefundCreatorInterface::class); } - function it_creates_refund_with_given_data_and_save_it_in_database( + public function it_creates_refund_with_given_data_and_save_it_in_database( RefundFactoryInterface $refundFactory, RemainingTotalProviderInterface $remainingTotalProvider, OrderRepositoryInterface $orderRepository, @@ -66,7 +66,7 @@ function it_creates_refund_with_given_data_and_save_it_in_database( $this('000222', 1, 1000, $refundType); } - function it_throws_an_exception_if_order_with_given_number_does_not_exist( + public function it_throws_an_exception_if_order_with_given_number_does_not_exist( OrderRepositoryInterface $orderRepository ): void { $refundType = RefundType::shipment(); @@ -75,11 +75,11 @@ function it_throws_an_exception_if_order_with_given_number_does_not_exist( $this ->shouldThrow(\InvalidArgumentException::class) - ->during('__invoke', ['000222', 1, 1000, $refundType]) + ->during('__invoke', ['000222', 1, 1000, $refundType]) ; } - function it_throws_exception_if_unit_has_already_been_refunded( + public function it_throws_exception_if_unit_has_already_been_refunded( OrderRepositoryInterface $orderRepository, RemainingTotalProviderInterface $remainingTotalProvider, OrderInterface $order diff --git a/src/Checker/OrderFullyRefundedTotalChecker.php b/src/Checker/OrderFullyRefundedTotalChecker.php index 223b9eef8..da5193ab2 100644 --- a/src/Checker/OrderFullyRefundedTotalChecker.php +++ b/src/Checker/OrderFullyRefundedTotalChecker.php @@ -15,7 +15,6 @@ use Sylius\Component\Core\Model\OrderInterface; use Sylius\RefundPlugin\Provider\OrderRefundedTotalProviderInterface; -use Webmozart\Assert\Assert; final class OrderFullyRefundedTotalChecker implements OrderFullyRefundedTotalCheckerInterface { diff --git a/src/Entity/Refund.php b/src/Entity/Refund.php index ec666b766..d1edf63f3 100644 --- a/src/Entity/Refund.php +++ b/src/Entity/Refund.php @@ -53,7 +53,7 @@ public function getOrder(): OrderInterface public function getOrderNumber(): string { - return $this->order->getNumber(); + return (string) $this->order->getNumber(); } public function getAmount(): int diff --git a/src/Entity/RefundInterface.php b/src/Entity/RefundInterface.php index b0ba2d76f..dc940c252 100644 --- a/src/Entity/RefundInterface.php +++ b/src/Entity/RefundInterface.php @@ -21,7 +21,7 @@ interface RefundInterface extends ResourceInterface { public function getOrder(): OrderInterface; - /** @deprecated this function is deprecated and will be removed in v1.0. Use RefundInterface::getOrder() instead */ + /** @deprecated this function is deprecated and will be removed in v1.0.0. Use RefundInterface::getOrder() instead */ public function getOrderNumber(): string; public function getAmount(): int; diff --git a/src/Migrations/Version20210608074013.php b/src/Migrations/Version20210608074013.php index f16b354d0..f10c18244 100644 --- a/src/Migrations/Version20210608074013.php +++ b/src/Migrations/Version20210608074013.php @@ -1,5 +1,14 @@