Skip to content

Commit

Permalink
Add ecs for spec directory
Browse files Browse the repository at this point in the history
  • Loading branch information
marekrzytki committed May 14, 2024
1 parent 1d8594e commit e48d3ab
Show file tree
Hide file tree
Showing 46 changed files with 330 additions and 330 deletions.
2 changes: 1 addition & 1 deletion ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
};
10 changes: 5 additions & 5 deletions spec/Checker/ProductProcessingCheckerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
final class ProductProcessingCheckerSpec extends ObjectBehavior
{
public function let(
ProductQuantityCheckerInterface $productQuantityChecker
ProductQuantityCheckerInterface $productQuantityChecker,
): void {
$this->beConstructedWith(
$productQuantityChecker
$productQuantityChecker,
);
}

Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions spec/Checker/ProductQuantityCheckerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ public function it_is_initializable(): void
}

public function it_has_positive_number_of_products(
OrderItemInterface $product
OrderItemInterface $product,
): void {
$product->getQuantity()->willReturn(4);

$this->hasPositiveQuantity($product)->shouldReturn(true);
}

public function it_has_zero_products(
OrderItemInterface $product
OrderItemInterface $product,
): void {
$product->getQuantity()->willReturn(0);

Expand Down
9 changes: 5 additions & 4 deletions spec/Checker/WishlistNameCheckerSpec.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

namespace spec\BitBag\SyliusWishlistPlugin\CommandHandler\Wishlist;

use BitBag\SyliusWishlistPlugin\Command\Wishlist\AddProductToSelectedWishlist;
use BitBag\SyliusWishlistPlugin\Command\Wishlist\AddProductToSelectedWishlistInterface;
use BitBag\SyliusWishlistPlugin\CommandHandler\Wishlist\AddProductToSelectedWishlistHandler;
use BitBag\SyliusWishlistPlugin\Entity\WishlistInterface;
Expand All @@ -24,11 +24,11 @@ final class AddProductToSelectedWishlistHandlerSpec extends ObjectBehavior
{
public function let(
WishlistProductFactoryInterface $wishlistProductFactory,
WishlistRepositoryInterface $wishlistRepository
WishlistRepositoryInterface $wishlistRepository,
): void {
$this->beConstructedWith(
$wishlistProductFactory,
$wishlistRepository
$wishlistRepository,
);
}

Expand All @@ -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);

Expand Down
25 changes: 11 additions & 14 deletions spec/CommandHandler/Wishlist/AddProductToWishlistHandlerSpec.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

namespace spec\BitBag\SyliusWishlistPlugin\CommandHandler\Wishlist;

use BitBag\SyliusWishlistPlugin\Command\Wishlist\AddProductToWishlist;
use BitBag\SyliusWishlistPlugin\Command\Wishlist\WishlistTokenValueAwareInterface;
use BitBag\SyliusWishlistPlugin\CommandHandler\Wishlist\AddProductToWishlistHandler;
use BitBag\SyliusWishlistPlugin\Entity\WishlistInterface;
use BitBag\SyliusWishlistPlugin\Entity\WishlistProductInterface;
use BitBag\SyliusWishlistPlugin\Exception\ProductNotFoundException;
use BitBag\SyliusWishlistPlugin\Exception\WishlistNotFoundException;
use BitBag\SyliusWishlistPlugin\Factory\WishlistProductFactoryInterface;
use Doctrine\Persistence\ObjectManager;
use PhpSpec\ObjectBehavior;
Expand All @@ -28,12 +27,12 @@ final class AddProductToWishlistHandlerSpec extends ObjectBehavior
public function let(
WishlistProductFactoryInterface $wishlistProductFactory,
ProductRepositoryInterface $productRepository,
ObjectManager $wishlistManager
ObjectManager $wishlistManager,
): void {
$this->beConstructedWith(
$wishlistProductFactory,
$productRepository,
$wishlistManager
$wishlistManager,
);
}

Expand All @@ -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);
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

namespace spec\BitBag\SyliusWishlistPlugin\CommandHandler\Wishlist;

use BitBag\SyliusWishlistPlugin\Command\Wishlist\AddProductVariantToWishlist;
use BitBag\SyliusWishlistPlugin\Command\Wishlist\WishlistTokenValueAwareInterface;
use BitBag\SyliusWishlistPlugin\CommandHandler\Wishlist\AddProductVariantToWishlistHandler;
use BitBag\SyliusWishlistPlugin\Entity\WishlistInterface;
use BitBag\SyliusWishlistPlugin\Entity\WishlistProductInterface;
Expand All @@ -27,12 +27,12 @@ final class AddProductVariantToWishlistHandlerSpec extends ObjectBehavior
public function let(
WishlistProductFactoryInterface $wishlistProductFactory,
ProductVariantRepositoryInterface $productVariantRepository,
ObjectManager $wishlistManager
ObjectManager $wishlistManager,
): void {
$this->beConstructedWith(
$wishlistProductFactory,
$productVariantRepository,
$wishlistManager
$wishlistManager,
);
}

Expand All @@ -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);
Expand All @@ -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();
Expand Down
19 changes: 9 additions & 10 deletions spec/CommandHandler/Wishlist/AddProductsToCartHandlerSpec.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

Expand All @@ -18,7 +19,6 @@
use Sylius\Bundle\OrderBundle\Controller\AddToCartCommandInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\OrderItemInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Model\ProductVariantInterface;
use Sylius\Component\Core\Repository\OrderRepositoryInterface;
use Sylius\Component\Inventory\Checker\AvailabilityCheckerInterface;
Expand All @@ -35,14 +35,14 @@ public function let(
TranslatorInterface $translator,
OrderModifierInterface $orderModifier,
OrderRepositoryInterface $orderRepository,
AvailabilityCheckerInterface $availabilityChecker
AvailabilityCheckerInterface $availabilityChecker,
): void {
$this->beConstructedWith(
$requestStack,
$translator,
$orderModifier,
$orderRepository,
$availabilityChecker
$availabilityChecker,
);
}

Expand All @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

Expand All @@ -31,13 +32,13 @@ public function let(
OrderItemQuantityModifierInterface $itemQuantityModifier,
OrderModifierInterface $orderModifier,
OrderRepositoryInterface $orderRepository,
ProductProcessingCheckerInterface $productProcessingChecker
ProductProcessingCheckerInterface $productProcessingChecker,
): void {
$this->beConstructedWith(
$itemQuantityModifier,
$orderModifier,
$orderRepository,
$productProcessingChecker
$productProcessingChecker,
);
}

Expand All @@ -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);
Expand Down Expand Up @@ -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()]);

Expand Down
Loading

0 comments on commit e48d3ab

Please sign in to comment.