diff --git a/ecs.php b/ecs.php index fbc71b3c..7a2212bd 100644 --- a/ecs.php +++ b/ecs.php @@ -9,5 +9,5 @@ putenv('ALLOW_BITBAG_OS_HEADER=1'); $config->import('vendor/bitbag/coding-standard/ecs.php'); - $config->paths(['src', 'tests/Integration', 'tests/Behat', 'tests/Functional']); + $config->paths(['src', 'spec', 'tests/Integration', 'tests/Behat', 'tests/Functional']); }; diff --git a/spec/Checker/ProductProcessingCheckerSpec.php b/spec/Checker/ProductProcessingCheckerSpec.php index 8c61b431..94dd6051 100644 --- a/spec/Checker/ProductProcessingCheckerSpec.php +++ b/spec/Checker/ProductProcessingCheckerSpec.php @@ -23,10 +23,10 @@ final class ProductProcessingCheckerSpec extends ObjectBehavior { public function let( - ProductQuantityCheckerInterface $productQuantityChecker + ProductQuantityCheckerInterface $productQuantityChecker, ): void { $this->beConstructedWith( - $productQuantityChecker + $productQuantityChecker, ); } @@ -39,7 +39,7 @@ public function it_can_be_processed( WishlistItem $wishlistProduct, AddToCartCommandInterface $addToCartCommand, OrderItemInterface $orderItem, - ProductQuantityCheckerInterface $productQuantityChecker + ProductQuantityCheckerInterface $productQuantityChecker, ): void { $wishlistProduct->getCartItem()->willReturn($addToCartCommand); $addToCartCommand->getCartItem()->willReturn($orderItem); @@ -55,7 +55,7 @@ public function it_can_not_be_processed_due_to_lack_in_stock( OrderItemInterface $orderItem, ProductQuantityCheckerInterface $productQuantityChecker, FlashBagInterface $flashBag, - TranslatorInterface $translator + TranslatorInterface $translator, ): void { $wishlistProduct->getCartItem()->willReturn($addToCartCommand); $addToCartCommand->getCartItem()->willReturn($orderItem); @@ -71,7 +71,7 @@ public function it_can_not_be_processed_due_to_lack_in_quantity( OrderItemInterface $orderItem, ProductQuantityCheckerInterface $productQuantityChecker, FlashBagInterface $flashBag, - TranslatorInterface $translator + TranslatorInterface $translator, ): void { $wishlistProduct->getCartItem()->willReturn($addToCartCommand); $addToCartCommand->getCartItem()->willReturn($orderItem); diff --git a/spec/Checker/ProductQuantityCheckerSpec.php b/spec/Checker/ProductQuantityCheckerSpec.php index 6957c69f..c2468ac0 100644 --- a/spec/Checker/ProductQuantityCheckerSpec.php +++ b/spec/Checker/ProductQuantityCheckerSpec.php @@ -23,7 +23,7 @@ public function it_is_initializable(): void } public function it_has_positive_number_of_products( - OrderItemInterface $product + OrderItemInterface $product, ): void { $product->getQuantity()->willReturn(4); @@ -31,7 +31,7 @@ public function it_has_positive_number_of_products( } public function it_has_zero_products( - OrderItemInterface $product + OrderItemInterface $product, ): void { $product->getQuantity()->willReturn(0); diff --git a/spec/Checker/WishlistNameCheckerSpec.php b/spec/Checker/WishlistNameCheckerSpec.php index deb2eae6..c3d7001a 100644 --- a/spec/Checker/WishlistNameCheckerSpec.php +++ b/spec/Checker/WishlistNameCheckerSpec.php @@ -1,10 +1,11 @@ beConstructedWith( $wishlistProductFactory, - $wishlistRepository + $wishlistRepository, ); } @@ -43,9 +43,8 @@ public function it_adds_product_to_wishlist_if_product_is_found( WishlistInterface $wishlist, WishlistProductFactoryInterface $wishlistProductFactory, WishlistProductInterface $wishlistProduct, - WishlistRepositoryInterface $wishlistRepository - ): void - { + WishlistRepositoryInterface $wishlistRepository, + ): void { $addProductToSelectedWishlist->getProduct()->willReturn($product); $addProductToSelectedWishlist->getWishlist()->willReturn($wishlist); diff --git a/spec/CommandHandler/Wishlist/AddProductToWishlistHandlerSpec.php b/spec/CommandHandler/Wishlist/AddProductToWishlistHandlerSpec.php index a7c37b82..333fa44a 100644 --- a/spec/CommandHandler/Wishlist/AddProductToWishlistHandlerSpec.php +++ b/spec/CommandHandler/Wishlist/AddProductToWishlistHandlerSpec.php @@ -1,22 +1,21 @@ beConstructedWith( $wishlistProductFactory, $productRepository, - $wishlistManager + $wishlistManager, ); } @@ -48,9 +47,8 @@ public function it_adds_product_to_wishlist( ProductRepositoryInterface $productRepository, WishlistProductFactoryInterface $wishlistProductFactory, WishlistProductInterface $wishlistProduct, - ObjectManager $wishlistManager - ): void - { + ObjectManager $wishlistManager, + ): void { $productRepository->find(1)->willReturn($product); $wishlistProductFactory->createForWishlistAndProduct($wishlist, $product)->willReturn($wishlistProduct); @@ -71,9 +69,8 @@ public function it_doesnt_add_product_to_wishlist_if_product_isnt_found( ProductRepositoryInterface $productRepository, WishlistProductFactoryInterface $wishlistProductFactory, WishlistProductInterface $wishlistProduct, - ObjectManager $wishlistManager - ): void - { + ObjectManager $wishlistManager, + ): void { $productRepository->find(1)->willReturn(null); $wishlistProductFactory->createForWishlistAndProduct($wishlist, $product)->shouldNotBeCalled(); diff --git a/spec/CommandHandler/Wishlist/AddProductVariantToWishlistHandlerSpec.php b/spec/CommandHandler/Wishlist/AddProductVariantToWishlistHandlerSpec.php index b2c3563b..6fc4ec44 100644 --- a/spec/CommandHandler/Wishlist/AddProductVariantToWishlistHandlerSpec.php +++ b/spec/CommandHandler/Wishlist/AddProductVariantToWishlistHandlerSpec.php @@ -1,17 +1,17 @@ beConstructedWith( $wishlistProductFactory, $productVariantRepository, - $wishlistManager + $wishlistManager, ); } @@ -47,9 +47,8 @@ public function it_adds_product_variant_to_wishlist( ProductVariantRepositoryInterface $productVariantRepository, WishlistProductFactoryInterface $wishlistProductFactory, WishlistProductInterface $wishlistProduct, - ObjectManager $wishlistManager - ): void - { + ObjectManager $wishlistManager, + ): void { $productVariantRepository->find(1)->willReturn($productVariant); $wishlistProductFactory->createForWishlistAndVariant($wishlist, $productVariant)->willReturn($wishlistProduct); @@ -70,9 +69,8 @@ public function it_doesnt_add_product_variant_to_wishlist_if_variant_isnt_found( ProductVariantRepositoryInterface $productVariantRepository, WishlistProductFactoryInterface $wishlistProductFactory, WishlistProductInterface $wishlistProduct, - ObjectManager $wishlistManager - ): void - { + ObjectManager $wishlistManager, + ): void { $productVariantRepository->find(1)->willReturn(null); $wishlistProductFactory->createForWishlistAndVariant($wishlist, $productVariant)->shouldNotBeCalled(); diff --git a/spec/CommandHandler/Wishlist/AddProductsToCartHandlerSpec.php b/spec/CommandHandler/Wishlist/AddProductsToCartHandlerSpec.php index 45b76800..87c2f49e 100644 --- a/spec/CommandHandler/Wishlist/AddProductsToCartHandlerSpec.php +++ b/spec/CommandHandler/Wishlist/AddProductsToCartHandlerSpec.php @@ -1,10 +1,11 @@ beConstructedWith( $requestStack, $translator, $orderModifier, $orderRepository, - $availabilityChecker + $availabilityChecker, ); } @@ -51,7 +51,6 @@ public function it_is_initializable(): void $this->shouldHaveType(AddProductsToCartHandler::class); } - public function it_adds_products_from_wishlist_to_cart( AvailabilityCheckerInterface $availabilityChecker, ProductVariantInterface $productVariant, @@ -65,7 +64,7 @@ public function it_adds_products_from_wishlist_to_cart( RequestStack $requestStack, Session $session, FlashBagInterface $flashBag, - TranslatorInterface $translator + TranslatorInterface $translator, ): void { $collection = new ArrayCollection([$wishlistProduct->getWrappedObject()]); $addProductsToCart->getWishlistProducts()->willReturn($collection); @@ -104,7 +103,7 @@ public function it_doesnt_add_products_from_wishlist_to_cart_if_stock_is_insuffi RequestStack $requestStack, Session $session, FlashBagInterface $flashBag, - TranslatorInterface $translator + TranslatorInterface $translator, ): void { $collection = new ArrayCollection([$wishlistProduct->getWrappedObject()]); $addProductsToCart->getWishlistProducts()->willReturn($collection); diff --git a/spec/CommandHandler/Wishlist/AddSelectedProductsToCartHandlerSpec.php b/spec/CommandHandler/Wishlist/AddSelectedProductsToCartHandlerSpec.php index 3583feb0..13e94cfb 100644 --- a/spec/CommandHandler/Wishlist/AddSelectedProductsToCartHandlerSpec.php +++ b/spec/CommandHandler/Wishlist/AddSelectedProductsToCartHandlerSpec.php @@ -1,10 +1,11 @@ beConstructedWith( $itemQuantityModifier, $orderModifier, $orderRepository, - $productProcessingChecker + $productProcessingChecker, ); } @@ -54,7 +55,7 @@ public function it_adds_selected_products_to_cart( OrderInterface $order, OrderItemInterface $orderItem, AddToCartCommandInterface $addToCartCommand, - ProductProcessingCheckerInterface $productProcessingChecker + ProductProcessingCheckerInterface $productProcessingChecker, ): void { $collection = new ArrayCollection([$wishlistProduct->getWrappedObject()]); $productProcessingChecker->canBeProcessed($wishlistProduct)->willReturn(true); @@ -83,7 +84,7 @@ public function it_doesnt_add_selected_products_to_cart_if_product_cannot_be_pro OrderInterface $order, OrderItemInterface $orderItem, AddToCartCommandInterface $addToCartCommand, - ProductProcessingCheckerInterface $productProcessingChecker + ProductProcessingCheckerInterface $productProcessingChecker, ): void { $collection = new ArrayCollection([$wishlistProduct->getWrappedObject()]); diff --git a/spec/CommandHandler/Wishlist/AddWishlistToUserHandlerSpec.php b/spec/CommandHandler/Wishlist/AddWishlistToUserHandlerSpec.php index cec7e67a..59b93d11 100644 --- a/spec/CommandHandler/Wishlist/AddWishlistToUserHandlerSpec.php +++ b/spec/CommandHandler/Wishlist/AddWishlistToUserHandlerSpec.php @@ -1,10 +1,11 @@ beConstructedWith( $wishlistRepository, - $wishlistCookieTokenResolver + $wishlistCookieTokenResolver, ); } @@ -40,7 +41,7 @@ public function it_adds_wishlist_to_user( WishlistInterface $wishlist, ShopUserInterface $shopUser, WishlistRepositoryInterface $wishlistRepository, - WishlistCookieTokenResolverInterface $wishlistCookieTokenResolver + WishlistCookieTokenResolverInterface $wishlistCookieTokenResolver, ): void { $wishlistCookieTokenResolver->resolve()->willReturn('token'); @@ -62,7 +63,7 @@ public function it_doesnt_add_wishlist_to_user_if_token_doesnt_match( WishlistInterface $wishlist, ShopUserInterface $shopUser, WishlistRepositoryInterface $wishlistRepository, - WishlistCookieTokenResolverInterface $wishlistCookieTokenResolver + WishlistCookieTokenResolverInterface $wishlistCookieTokenResolver, ): void { $wishlistCookieTokenResolver->resolve()->willReturn('token'); diff --git a/spec/CommandHandler/Wishlist/CopySelectedProductsToOtherWishlistHandlerSpec.php b/spec/CommandHandler/Wishlist/CopySelectedProductsToOtherWishlistHandlerSpec.php index 74a06de3..f777008a 100644 --- a/spec/CommandHandler/Wishlist/CopySelectedProductsToOtherWishlistHandlerSpec.php +++ b/spec/CommandHandler/Wishlist/CopySelectedProductsToOtherWishlistHandlerSpec.php @@ -23,11 +23,11 @@ final class CopySelectedProductsToOtherWishlistHandlerSpec extends ObjectBehavio { public function let( WishlistRepositoryInterface $wishlistRepository, - WishlistProductsToOtherWishlistDuplicatorInterface $copyistProductsToWishlist + WishlistProductsToOtherWishlistDuplicatorInterface $copyistProductsToWishlist, ): void { $this->beConstructedWith( $wishlistRepository, - $copyistProductsToWishlist + $copyistProductsToWishlist, ); } @@ -41,7 +41,7 @@ public function it_copy_selected_products_to_another_wishlist( Collection $wishlistProducts, WishlistRepositoryInterface $wishlistRepository, CopySelectedProductsToOtherWishlistInterface $copySelectedProductsToOtherWishlist, - WishlistProductsToOtherWishlistDuplicatorInterface $copyistProductsToWishlist + WishlistProductsToOtherWishlistDuplicatorInterface $copyistProductsToWishlist, ): void { $copySelectedProductsToOtherWishlist->getWishlistProducts()->willReturn($wishlistProducts); $copySelectedProductsToOtherWishlist->getDestinedWishlistId()->willReturn(2); diff --git a/spec/CommandHandler/Wishlist/CreateNewWishlistHandlerSpec.php b/spec/CommandHandler/Wishlist/CreateNewWishlistHandlerSpec.php index 4680dba1..9ee9bf7b 100644 --- a/spec/CommandHandler/Wishlist/CreateNewWishlistHandlerSpec.php +++ b/spec/CommandHandler/Wishlist/CreateNewWishlistHandlerSpec.php @@ -1,10 +1,11 @@ beConstructedWith( $wishlistRepository, @@ -45,7 +45,7 @@ public function let( $wishlistCookieTokenResolver, $channelRepository, $wishlistNameChecker, - $tokenUserResolver + $tokenUserResolver, ); } @@ -66,7 +66,7 @@ public function it_creates_new_wishlist_for_user( WishlistInterface $wishlist, WishlistInterface $existingWishlist, ChannelInterface $channel, - TokenUserResolverInterface $tokenUserResolver + TokenUserResolverInterface $tokenUserResolver, ): void { $wishlists = [$existingWishlist]; @@ -103,7 +103,7 @@ public function it_creates_new_wishlist_for_guest( ChannelRepositoryInterface $channelRepository, WishlistInterface $newWishlist, ChannelInterface $channel, - TokenUserResolverInterface $tokenUserResolver + TokenUserResolverInterface $tokenUserResolver, ): void { $tokenStorage->getToken()->willReturn(null); $tokenUserResolver->resolve(null)->willReturn(null); @@ -136,7 +136,7 @@ public function it_doesnt_add_duplicated_wishlist_name_for_user( WishlistInterface $wishlist, WishlistInterface $existingWishlist, ChannelInterface $channel, - TokenUserResolverInterface $tokenUserResolver + TokenUserResolverInterface $tokenUserResolver, ): void { $wishlists = [$existingWishlist]; diff --git a/spec/CommandHandler/Wishlist/CreateWishlistHandlerSpec.php b/spec/CommandHandler/Wishlist/CreateWishlistHandlerSpec.php index 8ee5c213..01258a36 100644 --- a/spec/CommandHandler/Wishlist/CreateWishlistHandlerSpec.php +++ b/spec/CommandHandler/Wishlist/CreateWishlistHandlerSpec.php @@ -1,10 +1,11 @@ getWishlistProducts() diff --git a/spec/CommandHandler/Wishlist/ExportWishlistToCsvHandlerSpec.php b/spec/CommandHandler/Wishlist/ExportWishlistToCsvHandlerSpec.php index f8871cfb..8c1a0433 100644 --- a/spec/CommandHandler/Wishlist/ExportWishlistToCsvHandlerSpec.php +++ b/spec/CommandHandler/Wishlist/ExportWishlistToCsvHandlerSpec.php @@ -1,10 +1,11 @@ beConstructedWith( $csvWishlistProductFactory, - $csvSerializerFactory + $csvSerializerFactory, ); } @@ -57,7 +54,7 @@ public function it_exports_wishlist_to_csv( CsvWishlistProductFactoryInterface $csvWishlistProductFactory, CsvWishlistProductInterface $csvWishlistProduct, CsvSerializerFactoryInterface $csvSerializerFactory, - Serializer $serializer + Serializer $serializer, ): void { $wishlistProducts = new ArrayCollection([$wishlistItem->getWrappedObject()]); diff --git a/spec/CommandHandler/Wishlist/RemoveProductFromWishlistHandlerSpec.php b/spec/CommandHandler/Wishlist/RemoveProductFromWishlistHandlerSpec.php index d01135fb..f1c3e0ae 100644 --- a/spec/CommandHandler/Wishlist/RemoveProductFromWishlistHandlerSpec.php +++ b/spec/CommandHandler/Wishlist/RemoveProductFromWishlistHandlerSpec.php @@ -1,10 +1,11 @@ beConstructedWith( $productRepository, $wishlistRepository, $wishlistProductRepository, - $wishlistManager + $wishlistManager, ); } @@ -52,7 +52,7 @@ public function it_removes_product_from_wishlist( ObjectManager $wishlistManager, ProductInterface $product, WishlistInterface $wishlist, - WishlistProductInterface $wishlistProduct + WishlistProductInterface $wishlistProduct, ): void { $removeProductCommand = new RemoveProductFromWishlist(1, 'wishlist_token'); @@ -83,7 +83,7 @@ public function it_throws_exception_when_wishlist_not_found( WishlistRepositoryInterface $wishlistRepository, ProductInterface $product, WishlistProductInterface $wishlistProduct, - RepositoryInterface $wishlistProductRepository + RepositoryInterface $wishlistProductRepository, ): void { $removeProductCommand = new RemoveProductFromWishlist(1, 'wishlist_token'); diff --git a/spec/CommandHandler/Wishlist/RemoveProductVariantFromWishlistHandlerSpec.php b/spec/CommandHandler/Wishlist/RemoveProductVariantFromWishlistHandlerSpec.php index 59eaba57..94d67ab6 100644 --- a/spec/CommandHandler/Wishlist/RemoveProductVariantFromWishlistHandlerSpec.php +++ b/spec/CommandHandler/Wishlist/RemoveProductVariantFromWishlistHandlerSpec.php @@ -1,10 +1,11 @@ beConstructedWith( $wishlistRepository, $productVariantRepository, $wishlistProductRepository, - $wishlistManager + $wishlistManager, ); } @@ -51,7 +52,7 @@ public function it_removes_product_variant_from_wishlist( ObjectManager $wishlistManager, ProductVariantInterface $variant, WishlistInterface $wishlist, - WishlistProductInterface $wishlistProduct + WishlistProductInterface $wishlistProduct, ): void { $removeProductVariantCommand = new RemoveProductVariantFromWishlist(1, 'wishlist_token'); @@ -66,7 +67,7 @@ public function it_removes_product_variant_from_wishlist( } public function it_throws_exception_when_product_variant_not_found( - ProductVariantRepositoryInterface $productVariantRepository + ProductVariantRepositoryInterface $productVariantRepository, ): void { $removeProductVariantCommand = new RemoveProductVariantFromWishlist(1, 'wishlist_token'); diff --git a/spec/CommandHandler/Wishlist/RemoveSelectedProductsFromWishlistHandlerSpec.php b/spec/CommandHandler/Wishlist/RemoveSelectedProductsFromWishlistHandlerSpec.php index fa8a29d5..beba66fd 100644 --- a/spec/CommandHandler/Wishlist/RemoveSelectedProductsFromWishlistHandlerSpec.php +++ b/spec/CommandHandler/Wishlist/RemoveSelectedProductsFromWishlistHandlerSpec.php @@ -1,25 +1,23 @@ beConstructedWith( $productVariantRepository, $wishlistProductManager, $requestStack, - $translator + $translator, ); } @@ -57,7 +55,7 @@ public function it_removes_selected_products_from_wishlist( RequestStack $requestStack, Session $session, FlashBagInterface $flashBag, - TranslatorInterface $translator + TranslatorInterface $translator, ): void { $removeSelectedProductsCommand = new RemoveSelectedProductsFromWishlist(new ArrayCollection([$wishlistItem->getWrappedObject()])); @@ -74,7 +72,7 @@ public function it_removes_selected_products_from_wishlist( public function it_throws_exception_when_variant_not_found( ProductVariantRepositoryInterface $productVariantRepository, WishlistItemInterface $wishlistItem, - WishlistProductInterface $wishlistProduct + WishlistProductInterface $wishlistProduct, ): void { $removeSelectedProductsCommand = new RemoveSelectedProductsFromWishlist(new ArrayCollection([$wishlistItem->getWrappedObject()])); @@ -85,4 +83,3 @@ public function it_throws_exception_when_variant_not_found( $this->shouldThrow(NotFoundHttpException::class)->during('__invoke', [$removeSelectedProductsCommand]); } } - diff --git a/spec/CommandHandler/Wishlist/RemoveWishlistHandlerSpec.php b/spec/CommandHandler/Wishlist/RemoveWishlistHandlerSpec.php index c3a4a707..778fbf54 100644 --- a/spec/CommandHandler/Wishlist/RemoveWishlistHandlerSpec.php +++ b/spec/CommandHandler/Wishlist/RemoveWishlistHandlerSpec.php @@ -1,10 +1,11 @@ beConstructedWith($wishlistRepository, $wishlistManager); } @@ -35,7 +36,7 @@ public function it_is_initializable(): void public function it_removes_matching_wishlist( WishlistRepositoryInterface $wishlistRepository, ObjectManager $wishlistManager, - WishlistInterface $wishlist + WishlistInterface $wishlist, ): void { $removeWishlist = new RemoveWishlist('token'); @@ -50,7 +51,7 @@ public function it_removes_matching_wishlist( public function it_throws_exception_when_wishlist_isnt_found( WishlistRepositoryInterface $wishlistRepository, ObjectManager $wishlistManager, - WishlistInterface $wishlist + WishlistInterface $wishlist, ): void { $removeWishlist = new RemoveWishlist('token'); diff --git a/spec/CommandHandler/Wishlist/UpdateWishlistNameHandlerSpec.php b/spec/CommandHandler/Wishlist/UpdateWishlistNameHandlerSpec.php index f3f461d8..d96c9d52 100644 --- a/spec/CommandHandler/Wishlist/UpdateWishlistNameHandlerSpec.php +++ b/spec/CommandHandler/Wishlist/UpdateWishlistNameHandlerSpec.php @@ -1,10 +1,11 @@ beConstructedWith($wishlistRepository, $wishlistCookieTokenResolver); } @@ -35,7 +36,7 @@ public function it_is_initializable(): void public function it_renames_found_wishlist( WishlistRepositoryInterface $wishlistRepository, WishlistCookieTokenResolverInterface $wishlistCookieTokenResolver, - WishlistInterface $wishlist + WishlistInterface $wishlist, ): void { $updateWishlistName = new UpdateWishlistName('newName', $wishlist->getWrappedObject()); @@ -54,7 +55,7 @@ public function it_throws_exception_when_wishlist_name_is_already_taken( WishlistRepositoryInterface $wishlistRepository, WishlistCookieTokenResolverInterface $wishlistCookieTokenResolver, WishlistInterface $wishlist, - WishlistInterface $existingWishlist + WishlistInterface $existingWishlist, ): void { $updateWishlistName = new UpdateWishlistName('newName', $wishlist->getWrappedObject()); diff --git a/spec/Context/WishlistContextSpec.php b/spec/Context/WishlistContextSpec.php index 140c3f90..025ef3ab 100644 --- a/spec/Context/WishlistContextSpec.php +++ b/spec/Context/WishlistContextSpec.php @@ -1,10 +1,11 @@ getToken()->willReturn($token); $tokenUserResolver->resolve($token)->willReturn($shopUser); $channelContext->getChannel()->willReturn($channel); - $wishlistRepository->findOneByShopUserAndChannel($shopUser,$channel)->willReturn($wishlist); - + $wishlistRepository->findOneByShopUserAndChannel($shopUser, $channel)->willReturn($wishlist); $this->getWishlist($request)->shouldReturn($wishlist); } @@ -153,9 +153,8 @@ public function it_returns_new_wishlist_if_not_found_and_user_logged_in( $tokenStorage->getToken()->willReturn($token); $tokenUserResolver->resolve($token)->willReturn($shopUser); $channelContext->getChannel()->willReturn($channel); - $wishlistRepository->findOneByShopUserAndChannel($shopUser,$channel)->willReturn(null); - $wishlistFactory->createForUserAndChannel($shopUser,$channel)->willReturn($wishlist); - + $wishlistRepository->findOneByShopUserAndChannel($shopUser, $channel)->willReturn(null); + $wishlistFactory->createForUserAndChannel($shopUser, $channel)->willReturn($wishlist); $this->getWishlist($request)->shouldReturn($wishlist); } diff --git a/spec/Controller/Action/AddProductToWishlistActionSpec.php b/spec/Controller/Action/AddProductToWishlistActionSpec.php index c25efa75..96b6aca9 100644 --- a/spec/Controller/Action/AddProductToWishlistActionSpec.php +++ b/spec/Controller/Action/AddProductToWishlistActionSpec.php @@ -1,10 +1,11 @@ beConstructedWith( $productRepository, @@ -53,7 +52,7 @@ public function let( $wishlistsResolver, $wishlistManager, $channelContext, - $wishlistCookieTokenResolver + $wishlistCookieTokenResolver, ); } @@ -87,7 +86,7 @@ public function it_handles_the_request_and_persist_new_wishlist_for_logged_shop_ ParameterBag $headers, Session $session, FlashBagInterface $flashBag, - WishlistCookieTokenResolverInterface $wishlistCookieTokenResolver + WishlistCookieTokenResolverInterface $wishlistCookieTokenResolver, ): void { $request->get('productId')->willReturn(1); @@ -137,7 +136,7 @@ public function it_handles_the_request_and_persist_new_wishlist_for_anonymous_us ParameterBag $headers, Session $session, FlashBagInterface $flashBag, - WishlistCookieTokenResolverInterface $wishlistCookieTokenResolver + WishlistCookieTokenResolverInterface $wishlistCookieTokenResolver, ): void { $request->get('productId')->willReturn(1); $productRepository->find(1)->willReturn($product); diff --git a/spec/Controller/Action/AddProductVariantToWishlistActionSpec.php b/spec/Controller/Action/AddProductVariantToWishlistActionSpec.php index 52b2670d..5fd68ff3 100644 --- a/spec/Controller/Action/AddProductVariantToWishlistActionSpec.php +++ b/spec/Controller/Action/AddProductVariantToWishlistActionSpec.php @@ -1,10 +1,11 @@ beConstructedWith( $productVariantRepository, @@ -44,7 +45,7 @@ public function let( $requestStack, $translator, $urlGenerator, - $wishlistRepository + $wishlistRepository, ); } @@ -55,7 +56,7 @@ public function it_is_initializable(): void public function it_throws_404_when_wishlist_is_not_found( Request $request, - WishlistRepositoryInterface $wishlistRepository + WishlistRepositoryInterface $wishlistRepository, ): void { $wishlistRepository->find(1)->willReturn(null); @@ -66,7 +67,7 @@ public function it_throws_404_when_product_is_not_found( Request $request, ProductVariantRepositoryInterface $productVariantRepository, WishlistRepositoryInterface $wishlistRepository, - WishlistInterface $wishlist + WishlistInterface $wishlist, ): void { $wishlistRepository->find(1)->willReturn($wishlist); $request->get('variantId')->willReturn(1); diff --git a/spec/Controller/Action/ListWishlistProductsActionSpec.php b/spec/Controller/Action/ListWishlistProductsActionSpec.php index f031ba4e..41713379 100644 --- a/spec/Controller/Action/ListWishlistProductsActionSpec.php +++ b/spec/Controller/Action/ListWishlistProductsActionSpec.php @@ -1,10 +1,11 @@ beConstructedWith( $cartContext, @@ -47,7 +48,7 @@ public function let( $wishlistCommandProcessor, $wishlistsResolver, $translator, - $generator + $generator, ); } @@ -69,7 +70,7 @@ public function it_lists_wishlist_items( FormView $formView, Environment $twigEnvironment, WishlistCommandProcessorInterface $wishlistCommandProcessor, - ArrayCollection $commandsArray + ArrayCollection $commandsArray, ): void { $wishlistsResolver->resolveAndCreate() ->willReturn([ @@ -85,7 +86,7 @@ public function it_lists_wishlist_items( ->create( WishlistCollectionType::class, ['items' => $commandsArray], - ['cart' => $cart] + ['cart' => $cart], ) ->willReturn($form); @@ -96,7 +97,7 @@ public function it_lists_wishlist_items( [ 'wishlist' => $wishlist, 'form' => $formView, - ] + ], ) ->willReturn('CONTENT'); diff --git a/spec/Controller/Action/RemoveProductFromWishlistActionSpec.php b/spec/Controller/Action/RemoveProductFromWishlistActionSpec.php index 025287e3..2a5491cc 100644 --- a/spec/Controller/Action/RemoveProductFromWishlistActionSpec.php +++ b/spec/Controller/Action/RemoveProductFromWishlistActionSpec.php @@ -1,10 +1,11 @@ beConstructedWith( $wishlistContext, @@ -44,7 +45,7 @@ public function let( $wishlistProductManager, $requestStack, $translator, - $urlGenerator + $urlGenerator, ); } diff --git a/spec/Controller/Action/RenderHeaderTemplateActionSpec.php b/spec/Controller/Action/RenderHeaderTemplateActionSpec.php index 204ff19a..1d8d286a 100644 --- a/spec/Controller/Action/RenderHeaderTemplateActionSpec.php +++ b/spec/Controller/Action/RenderHeaderTemplateActionSpec.php @@ -1,10 +1,11 @@ beConstructedWith( $twigEnvironment, - $wishlistsResolver + $wishlistsResolver, ); } @@ -37,7 +38,7 @@ public function it_is_initializable(): void public function it_renders_header_template( Request $request, WishlistsResolverInterface $wishlistsResolver, - Environment $twigEnvironment + Environment $twigEnvironment, ): void { $wishlists = []; $wishlistsResolver->resolve()->willReturn($wishlists); diff --git a/spec/DependencyInjection/BitBagSyliusWishlistExtensionSpec.php b/spec/DependencyInjection/BitBagSyliusWishlistExtensionSpec.php index d9b5a7b4..71ce5058 100644 --- a/spec/DependencyInjection/BitBagSyliusWishlistExtensionSpec.php +++ b/spec/DependencyInjection/BitBagSyliusWishlistExtensionSpec.php @@ -1,10 +1,11 @@ beConstructedWith( $wishlistProductVariantFactory, $productVariantRepository, $wishlistRepository, $requestStack, - $translator + $translator, ); } @@ -51,10 +50,10 @@ public function it_copy_wishlist_products( ProductVariantInterface $variant1, ProductVariantInterface $variant2, WishlistInterface $destinedWishlist, - WishlistRepositoryInterface $wishlistRepository + WishlistRepositoryInterface $wishlistRepository, ): void { - $productVariantRepository->find("1")->willReturn($variant1); - $productVariantRepository->find("24")->willReturn($variant2); + $productVariantRepository->find('1')->willReturn($variant1); + $productVariantRepository->find('24')->willReturn($variant2); $destinedWishlist->hasProductVariant($variant1)->shouldBeCalled(); $destinedWishlist->hasProductVariant($variant2)->shouldBeCalled(); @@ -63,11 +62,11 @@ public function it_copy_wishlist_products( $this->copyWishlistProductsToOtherWishlist(new ArrayCollection([ [ - "variant" => "1" + 'variant' => '1', ], [ - "variant" => "24" - ] + 'variant' => '24', + ], ]), $destinedWishlist); } } diff --git a/spec/Entity/WishlistProductSpec.php b/spec/Entity/WishlistProductSpec.php index 6154d96c..6b88d503 100644 --- a/spec/Entity/WishlistProductSpec.php +++ b/spec/Entity/WishlistProductSpec.php @@ -1,10 +1,11 @@ getVariant()->willReturn($productVariant); diff --git a/spec/Facade/WishlistProductFactoryFacadeSpec.php b/spec/Facade/WishlistProductFactoryFacadeSpec.php index ee7de268..66031051 100644 --- a/spec/Facade/WishlistProductFactoryFacadeSpec.php +++ b/spec/Facade/WishlistProductFactoryFacadeSpec.php @@ -23,10 +23,10 @@ final class WishlistProductFactoryFacadeSpec extends ObjectBehavior { public function let( - WishlistProductFactoryInterface $wishlistProductFactory + WishlistProductFactoryInterface $wishlistProductFactory, ): void { $this->beConstructedWith( - $wishlistProductFactory + $wishlistProductFactory, ); } @@ -40,7 +40,7 @@ public function it_should_create_wishlist_product_variant_and_add_it_to_wishlist WishlistInterface $wishlist, ProductVariantInterface $productVariant, WishlistProductFactoryInterface $wishlistProductFactory, - WishlistProductInterface $wishlistProduct + WishlistProductInterface $wishlistProduct, ): void { $wishlistProductFactory->createForWishlistAndVariant($wishlist, $productVariant) ->willReturn($wishlistProduct); @@ -56,7 +56,7 @@ public function it_should_create_wishlist_product_and_add_it_to_wishlist( WishlistInterface $wishlist, ProductInterface $product, WishlistProductFactoryInterface $wishlistProductFactory, - WishlistProductInterface $wishlistProduct + WishlistProductInterface $wishlistProduct, ): void { $wishlistProductFactory->createForWishlistAndProduct($wishlist, $product) ->willReturn($wishlistProduct); diff --git a/spec/Factory/DomPdfFactorySpec.php b/spec/Factory/DomPdfFactorySpec.php index c1450c4c..e45e9e5b 100644 --- a/spec/Factory/DomPdfFactorySpec.php +++ b/spec/Factory/DomPdfFactorySpec.php @@ -21,7 +21,7 @@ final class DomPdfFactorySpec extends ObjectBehavior { public function let( - DomPdfOptionsFactoryInterface $domPdfOptionsFactory + DomPdfOptionsFactoryInterface $domPdfOptionsFactory, ): void { $this->beConstructedWith($domPdfOptionsFactory); } @@ -40,13 +40,13 @@ public function it_creates_new_dom_pdf(): void public function it_creates_new_dom_pdf_with_default_options( DomPdfOptionsFactoryInterface $domPdfOptionsFactory, - Options $pdfOptions + Options $pdfOptions, ): void { $domPdfOptionsFactory->createNew()->willReturn($pdfOptions); $pdfOptions->set('isRemoteEnabled', true)->shouldBeCalled(); $pdfOptions->set('defaultFont', 'Arial')->shouldBeCalled(); - $pdfOptions->getHttpContext()->willReturn(['http' =>[]]); + $pdfOptions->getHttpContext()->willReturn(['http' => []]); $domPdf = $this->createNewWithDefaultOptions(); $domPdf->shouldBeAnInstanceOf(Dompdf::class); diff --git a/spec/Factory/WishlistFactorySpec.php b/spec/Factory/WishlistFactorySpec.php index 2b549b16..16081808 100644 --- a/spec/Factory/WishlistFactorySpec.php +++ b/spec/Factory/WishlistFactorySpec.php @@ -1,10 +1,11 @@ createNew()->willReturn($wishlist); diff --git a/spec/Factory/WishlistProductFactorySpec.php b/spec/Factory/WishlistProductFactorySpec.php index ff902056..73f41086 100644 --- a/spec/Factory/WishlistProductFactorySpec.php +++ b/spec/Factory/WishlistProductFactorySpec.php @@ -1,10 +1,11 @@ createNew()->willReturn($wishlistProduct); @@ -52,7 +53,7 @@ public function it_creates_wishlist_product_for_wishlist_and_product( WishlistInterface $wishlist, ProductInterface $product, ProductVariantInterface $productVariant, - Collection $productVariants + Collection $productVariants, ): void { $product->getVariants()->willReturn($productVariants); $productVariants->first()->willReturn($productVariant); @@ -71,7 +72,7 @@ public function it_creates_wishlist_product_for_wishlist_and_variant( WishlistProductInterface $wishlistProduct, WishlistInterface $wishlist, ProductInterface $product, - ProductVariantInterface $productVariant + ProductVariantInterface $productVariant, ): void { $productVariant->getProduct()->willReturn($product); diff --git a/spec/Model/Factory/VariantPdfModelFactorySpec.php b/spec/Model/Factory/VariantPdfModelFactorySpec.php index 89601175..41f7c47e 100644 --- a/spec/Model/Factory/VariantPdfModelFactorySpec.php +++ b/spec/Model/Factory/VariantPdfModelFactorySpec.php @@ -1,10 +1,11 @@ getVariant()->shouldReturn($productVariant); @@ -47,7 +48,7 @@ public function it_returns_product_pdf_model(): void $productVariant, 'http://127.0.0.1:8000/media/image/b4/c2/fc6b3202ee567e0fb05f293b709c.jpg', 10, - 'variant test' + 'variant test', )->shouldBeAnInstanceOf(VariantPdfModel::class); } } diff --git a/spec/Model/VariantPdfModelSpec.php b/spec/Model/VariantPdfModelSpec.php index 2bce9c57..1d5cb8e1 100644 --- a/spec/Model/VariantPdfModelSpec.php +++ b/spec/Model/VariantPdfModelSpec.php @@ -1,10 +1,11 @@ getVariant()->shouldReturn($productVariant); $this->getImagePath()->shouldReturn('/image/123/image.jpg'); $this->getQuantity()->shouldReturn(10); - } + } } diff --git a/spec/Processor/SelectedWishlistProductsProcessorSpec.php b/spec/Processor/SelectedWishlistProductsProcessorSpec.php index 99e4f87d..4feb946b 100644 --- a/spec/Processor/SelectedWishlistProductsProcessorSpec.php +++ b/spec/Processor/SelectedWishlistProductsProcessorSpec.php @@ -27,7 +27,7 @@ public function it_is_initializable(): void public function it_returns_selected_wishlist_items( WishlistItem $wishlistItem, - WishlistItem $wishlistItem2 + WishlistItem $wishlistItem2, ): void { $wishlistItem->isSelected()->willReturn(false); $wishlistItem2->isSelected()->willReturn(true); diff --git a/spec/Processor/VariantPdfModelProcessorSpec.php b/spec/Processor/VariantPdfModelProcessorSpec.php index 1342b70f..6a13e570 100644 --- a/spec/Processor/VariantPdfModelProcessorSpec.php +++ b/spec/Processor/VariantPdfModelProcessorSpec.php @@ -22,10 +22,10 @@ final class VariantPdfModelProcessorSpec extends ObjectBehavior { public function let( - ModelCreatorInterface $pdfModelCreator + ModelCreatorInterface $pdfModelCreator, ) { $this->beConstructedWith( - $pdfModelCreator + $pdfModelCreator, ); } @@ -40,7 +40,7 @@ public function it_returns_collection_of_pdf_model( WishlistItem $wishlistItem2, VariantPdfModelInterface $pdfModel, VariantPdfModelInterface $pdfModel2, - ModelCreatorInterface $pdfModelCreator + ModelCreatorInterface $pdfModelCreator, ): void { $pdfModelCreator->createWishlistItemToPdf($wishlistItem)->willReturn($pdfModel); $pdfModelCreator->createWishlistItemToPdf($wishlistItem2)->willReturn($pdfModel2); diff --git a/spec/Resolver/ShopUserWishlistResolverSpec.php b/spec/Resolver/ShopUserWishlistResolverSpec.php index 47f5166d..a174bbba 100644 --- a/spec/Resolver/ShopUserWishlistResolverSpec.php +++ b/spec/Resolver/ShopUserWishlistResolverSpec.php @@ -1,10 +1,12 @@ beConstructedWith( $wishlistRepository, $wishlistFactory, - $channelContext + $channelContext, ); } @@ -46,7 +48,7 @@ public function it_created_new_wishlist_for_shop_user_if_cannot_resolve_with_cha ChannelContextInterface $channelContext, ChannelInterface $channel, WishlistInterface $wishlist, - ShopUserInterface $user + ShopUserInterface $user, ): void { $channelContext->getChannel()->willReturn($channel); $wishlistRepository->findOneByShopUserAndChannel($user, $channel)->willReturn(null); @@ -61,7 +63,7 @@ public function it_resolves_wishlist_for_shop_user_with_channel( ChannelContextInterface $channelContext, ChannelInterface $channel, WishlistInterface $wishlist, - ShopUserInterface $user + ShopUserInterface $user, ): void { $channelContext->getChannel()->willReturn($channel); $wishlistRepository->findOneByShopUserAndChannel($user, $channel)->willReturn($wishlist); @@ -75,7 +77,7 @@ public function it_created_new_wishlist_for_shop_user_if_cannot_resolve_without_ WishlistFactoryInterface $wishlistFactory, ChannelContextInterface $channelContext, WishlistInterface $wishlist, - ShopUserInterface $user + ShopUserInterface $user, ): void { $channelContext->getChannel()->willThrow(ChannelNotFoundException::class); $wishlistRepository->findOneByShopUser($user)->willReturn(null); @@ -89,7 +91,7 @@ public function it_resolves_wishlist_for_shop_user_without_channel( WishlistFactoryInterface $wishlistFactory, ChannelContextInterface $channelContext, WishlistInterface $wishlist, - ShopUserInterface $user + ShopUserInterface $user, ): void { $channelContext->getChannel()->willThrow(ChannelNotFoundException::class); $wishlistRepository->findOneByShopUser($user)->willReturn($wishlist); diff --git a/spec/Resolver/TokenUserResolverSpec.php b/spec/Resolver/TokenUserResolverSpec.php index df30c18a..eba461d8 100644 --- a/spec/Resolver/TokenUserResolverSpec.php +++ b/spec/Resolver/TokenUserResolverSpec.php @@ -1,10 +1,11 @@ beConstructedWith( - $dataUriForImageResolver + $dataUriForImageResolver, ); } @@ -38,7 +39,7 @@ public function it_resolves_empty_image_path( ProductVariantInterface $variant, ProductInterface $product, Collection $productImages, - GenerateDataUriForImageResolverInterface $dataUriForImageResolver + GenerateDataUriForImageResolverInterface $dataUriForImageResolver, ): void { $variant->getProduct()->willReturn($product); $product->getImages()->willReturn($productImages); @@ -53,7 +54,7 @@ public function it_resolves_image_path( ProductInterface $product, Collection $productImages, ProductImage $productImage, - GenerateDataUriForImageResolverInterface $dataUriForImageResolver + GenerateDataUriForImageResolverInterface $dataUriForImageResolver, ): void { $variant->getProduct()->willReturn($product); $product->getImages()->willReturn($productImages); diff --git a/spec/Resolver/WishlistCookieTokenResolverSpec.php b/spec/Resolver/WishlistCookieTokenResolverSpec.php index 659cb61c..c9e4091f 100644 --- a/spec/Resolver/WishlistCookieTokenResolverSpec.php +++ b/spec/Resolver/WishlistCookieTokenResolverSpec.php @@ -1,10 +1,12 @@ beConstructedWith($requestStack, 'token'); } @@ -35,7 +36,7 @@ public function it_is_initializable(): void public function it_returns_wishlist_cookie_token_from_main_request_cookies( RequestStack $requestStack, Request $request, - ParameterBag $inputBag + ParameterBag $inputBag, ): void { $requestStack->getMainRequest()->willReturn($request); $inputBag->get('token')->willReturn('wishlist_token'); @@ -48,7 +49,7 @@ public function it_returns_wishlist_cookie_token_from_main_request_attributes( RequestStack $requestStack, Request $request, ParameterBag $inputBagCookies, - ParameterBag $inputBagAttributes + ParameterBag $inputBagAttributes, ): void { $requestStack->getMainRequest()->willReturn($request); $inputBagCookies->get('token')->willReturn(null); @@ -64,7 +65,7 @@ public function it_returns_new_wishlist_token_class_if_not_found_in_cookies_nor_ Request $request, ParameterBag $inputBagCookies, ParameterBag $inputBagAttributes, - WishlistToken $wishlistToken + WishlistToken $wishlistToken, ): void { $requestStack->getMainRequest()->willReturn($request); $inputBagCookies->get('token')->willReturn(null); diff --git a/spec/Resolver/WishlistsResolverSpec.php b/spec/Resolver/WishlistsResolverSpec.php index 0b8bcf3c..846e6d77 100644 --- a/spec/Resolver/WishlistsResolverSpec.php +++ b/spec/Resolver/WishlistsResolverSpec.php @@ -1,39 +1,28 @@ beConstructedWith( $wishlistRepository, @@ -53,7 +42,7 @@ public function let( $wishlistCookieTokenResolver, $channelContext, $tokenUserResolver, - $messageBus + $messageBus, ); } @@ -72,10 +61,10 @@ public function it_resolves_wishlists_by_shop_user_and_token( WishlistInterface $wishlist, TokenInterface $token, ShopUserInterface $user, - ChannelInterface $channel + ChannelInterface $channel, ): void { $wishlists = [ - $wishlist->getWrappedObject() + $wishlist->getWrappedObject(), ]; $wishlistToken = 'wishlist_token'; @@ -98,10 +87,10 @@ public function it_resolves_wishlists_by_token_and_channel_without_user( TokenUserResolverInterface $tokenUserResolver, WishlistInterface $wishlist, TokenInterface $token, - ChannelInterface $channel + ChannelInterface $channel, ): void { $wishlists = [ - $wishlist->getWrappedObject() + $wishlist->getWrappedObject(), ]; $wishlistToken = 'wishlist_token'; @@ -122,10 +111,10 @@ public function it_resolves_wishlists_by_token( ChannelContextInterface $channelContext, TokenUserResolverInterface $tokenUserResolver, WishlistInterface $wishlist, - TokenInterface $token + TokenInterface $token, ): void { $wishlists = [ - $wishlist->getWrappedObject() + $wishlist->getWrappedObject(), ]; $wishlistToken = 'wishlist_token'; diff --git a/spec/Services/Exporter/DomPdfWishlistExporterSpec.php b/spec/Services/Exporter/DomPdfWishlistExporterSpec.php index 1af403a6..661f972f 100644 --- a/spec/Services/Exporter/DomPdfWishlistExporterSpec.php +++ b/spec/Services/Exporter/DomPdfWishlistExporterSpec.php @@ -24,11 +24,11 @@ final class DomPdfWishlistExporterSpec extends ObjectBehavior { public function let( Environment $twigEnvironment, - DomPdfFactoryInterface $domPdfFactory + DomPdfFactoryInterface $domPdfFactory, ) { $this->beConstructedWith( $twigEnvironment, - $domPdfFactory + $domPdfFactory, ); } @@ -42,7 +42,7 @@ public function it_returns_pdf_as_attachment( Environment $twigEnvironment, VariantPdfModelInterface $pdfModel, Dompdf $dompdf, - DomPdfFactoryInterface $domPdfFactory + DomPdfFactoryInterface $domPdfFactory, ): void { $domPdfFactory->createNewWithDefaultOptions()->willReturn($dompdf); diff --git a/spec/Services/Generator/ModelCreatorSpec.php b/spec/Services/Generator/ModelCreatorSpec.php index 513d3f1b..aded1bb0 100644 --- a/spec/Services/Generator/ModelCreatorSpec.php +++ b/spec/Services/Generator/ModelCreatorSpec.php @@ -1,10 +1,12 @@ beConstructedWith( $variantImageToDataUriResolver, $variantPdfModelFactory, - $requestStack + $requestStack, ); } @@ -51,7 +53,7 @@ public function it_creates_pdf_model( VariantImageToDataUriResolverInterface $variantImageToDataUriResolver, VariantPdfModelFactoryInterface $variantPdfModelFactory, RequestStack $requestStack, - VariantPdfModelInterface $pdfModel + VariantPdfModelInterface $pdfModel, ): void { $wishlistItem->getCartItem()->willReturn($addToCartCommand); $addToCartCommand->getCartItem()->willReturn($orderItem); @@ -65,7 +67,7 @@ public function it_creates_pdf_model( $variant, 'url', 1, - 'code' + 'code', )->willReturn($pdfModel); $this->createWishlistItemToPdf($wishlistItem)->shouldReturn($pdfModel);