From fe53f2c9e5860c31607061a2e7e285778ed2828f Mon Sep 17 00:00:00 2001 From: token Date: Fri, 7 Jul 2023 16:26:00 +0200 Subject: [PATCH 01/22] Add more behat tests --- features/creating_bundled_product.feature | 34 +++++ .../having_bundled_product_in_store.feature | 31 ++++- .../Admin/Form/productBundleItem.html.twig | 4 +- .../Context/Setup/ProductBundleContext.php | 63 ++------- .../Behat/Context/Ui/ProductBundleContext.php | 91 ++++++++++++ .../Page/Admin/CreateBundledProductPage.php | 131 ++++++++++++++++++ .../CreateBundledProductPageInterface.php | 22 +++ tests/Behat/Resources/services.yml | 13 ++ tests/Behat/Resources/suites.yml | 22 ++- 9 files changed, 351 insertions(+), 60 deletions(-) create mode 100644 features/creating_bundled_product.feature create mode 100644 tests/Behat/Context/Ui/ProductBundleContext.php create mode 100644 tests/Behat/Page/Admin/CreateBundledProductPage.php create mode 100644 tests/Behat/Page/Admin/CreateBundledProductPageInterface.php diff --git a/features/creating_bundled_product.feature b/features/creating_bundled_product.feature new file mode 100644 index 00000000..be965851 --- /dev/null +++ b/features/creating_bundled_product.feature @@ -0,0 +1,34 @@ +@bundled_product +Feature: Creating a product in store which is a bundle of other products + I want to be able to add bundled product to cart + + Background: + Given the store operates on a single channel in "United States" + And I am logged in as an administrator + And the store has a product "Jack Daniels Gentleman" priced at "$10.00" + And the store has a product "Johny Walker Black" priced at "$10.00" + And the store has a product "Jim Beam Double Oak" priced at "$10.00" + + @ui @javascript + Scenario: Creating a bundled product + When I want to create a new bundled product + And I specify its code as "WHISKEY_PACK" + And I name it "Whiskey double pack" in "English (United States)" + And I set its slug to "whiskey-double-pack" in "English (United States)" + And I set its price to "$10.00" for "United States" channel + And I set its original price to "$20.00" for "United States" channel + And I add product "Johny Walker Black" and "Jack Daniels Gentleman" to the bundle + And I add it + Then I should be notified that it has been successfully created + + @ui @javascript + Scenario: Creating a bundled product with more products + When I want to create a new bundled product + And I specify its code as "WHISKEY_BIG_PACK" + And I name it "Whiskey triple pack" in "English (United States)" + And I set its slug to "whiskey-triple-pack" in "English (United States)" + And I set its price to "$10.00" for "United States" channel + And I set its original price to "$20.00" for "United States" channel + And I add product "Johny Walker Black" and "Jack Daniels Gentleman" and "Jim Beam Double Oak" to the bundle + And I add it + Then I should be notified that it has been successfully created diff --git a/features/having_bundled_product_in_store.feature b/features/having_bundled_product_in_store.feature index d1bdc501..e72f8e94 100644 --- a/features/having_bundled_product_in_store.feature +++ b/features/having_bundled_product_in_store.feature @@ -4,15 +4,38 @@ Feature: Having a product in store which is a bundle of other products Background: Given the store operates on a single channel in "United States" - And the store has locale en_US + And I am a logged in customer + And the store ships everywhere for Free + And the store allows paying Offline @ui - Scenario: Adding a product to cart - Given I am a logged in customer - And the store has a product "Jack Daniels Gentleman" priced at "$10.00" + Scenario: Adding a product bundle to the cart + Given the store has a product "Jack Daniels Gentleman" priced at "$10.00" And the store has a product "Johny Walker Black" priced at "$10.00" And the store has bundled product "Whiskey double pack" priced at "$18.00" which contains "Jack Daniels Gentleman" and "Johny Walker Black" And all store products appear under a main taxonomy Then I added product "Whiskey double pack" to the cart And I should be on my cart summary page And there should be one item in my cart + + @ui + Scenario: Adding a few product bundles to the cart + Given the store has a product "Jim Beam" priced at "$10.00" + And the store has a product "Jim Beam Double Oak" priced at "$10.00" + And the store has bundled product "Jim Beam double pack" priced at "$18.00" which contains "Jim Beam" and "Jim Beam Double Oak" + And all store products appear under a main taxonomy + Then I added product "Jim Beam double pack" to the cart + And I specify product "Jim Beam double pack" quantity to 5 + And I should be on my cart summary page + And I should see "Jim Beam double pack" with quantity 5 in my cart + + @ui + Scenario: Placing an order for a bundled product + Given the store has a product "Jim Beam" priced at "$10.00" + And the store has a product "Jim Beam Double Oak" priced at "$10.00" + And the store has bundled product "Jim Beam double pack" priced at "$18.00" which contains "Jim Beam" and "Jim Beam Double Oak" + Given I have product "Jim Beam double pack" in the cart + And I specified the billing address as "Ankh Morpork", "Frost Alley", "90210", "United States" for "Jon Snow" + And I proceed with "Free" shipping method and "Offline" payment + And I confirm my order + Then I should see the thank you page diff --git a/src/Resources/views/Admin/Form/productBundleItem.html.twig b/src/Resources/views/Admin/Form/productBundleItem.html.twig index 12786be3..60d9deb8 100644 --- a/src/Resources/views/Admin/Form/productBundleItem.html.twig +++ b/src/Resources/views/Admin/Form/productBundleItem.html.twig @@ -36,7 +36,7 @@ {% if prototype is defined and allow_add %} - + {{ button_add_label|trans }} @@ -49,7 +49,7 @@ {% apply spaceless %} - {{ form_row(form.productVariant, {'remote_url': path('bitbag_product_bundle_admin_ajax_product_variants_by_phrase'), 'remote_criteria_type': 'contains', 'remote_criteria_name': 'phrase', 'load_edit_url': path('bitbag_product_bundle_admin_ajax_product_variants_by_codes')}) }} +
{{ form_row(form.productVariant, {'remote_url': path('bitbag_product_bundle_admin_ajax_product_variants_by_phrase'), 'remote_criteria_type': 'contains', 'remote_criteria_name': 'phrase', 'load_edit_url': path('bitbag_product_bundle_admin_ajax_product_variants_by_codes')}) }}
{{ form_row(form.quantity) }} diff --git a/tests/Behat/Context/Setup/ProductBundleContext.php b/tests/Behat/Context/Setup/ProductBundleContext.php index e36ae923..9005a3d9 100644 --- a/tests/Behat/Context/Setup/ProductBundleContext.php +++ b/tests/Behat/Context/Setup/ProductBundleContext.php @@ -29,59 +29,18 @@ final class ProductBundleContext implements Context { - /** @var SharedStorageInterface */ - private $sharedStorage; - - /** @var FactoryInterface */ - private $taxonFactory; - - /** @var ProductRepositoryInterface */ - private $productRepository; - - /** @var FactoryInterface */ - private $productTaxonFactory; - - /** @var EntityManagerInterface */ - private $productTaxonManager; - - /** @var ProductFactory */ - private $productFactory; - - /** @var FactoryInterface */ - private $productBundleItemFactory; - - /** @var FactoryInterface */ - private $channelPricingFactory; - - /** @var ProductVariantResolverInterface */ - private $productVariantResolver; - - /** @var SlugGeneratorInterface */ - private $slugGenerator; - public function __construct( - SharedStorageInterface $sharedStorage, - FactoryInterface $taxonFactory, - ProductRepositoryInterface $productRepository, - FactoryInterface $productTaxonFactory, - EntityManagerInterface $productTaxonManager, - ProductFactory $productFactory, - FactoryInterface $productBundleItemFactory, - FactoryInterface $channelPricingFactory, - ProductVariantResolverInterface $productVariantResolver, - SlugGeneratorInterface $slugGenerator - ) { - $this->sharedStorage = $sharedStorage; - $this->taxonFactory = $taxonFactory; - $this->productRepository = $productRepository; - $this->productTaxonFactory = $productTaxonFactory; - $this->productTaxonManager = $productTaxonManager; - $this->productFactory = $productFactory; - $this->productBundleItemFactory = $productBundleItemFactory; - $this->channelPricingFactory = $channelPricingFactory; - $this->productVariantResolver = $productVariantResolver; - $this->slugGenerator = $slugGenerator; - } + private SharedStorageInterface $sharedStorage, + private FactoryInterface $taxonFactory, + private ProductRepositoryInterface $productRepository, + private FactoryInterface $productTaxonFactory, + private EntityManagerInterface $productTaxonManager, + private ProductFactory $productFactory, + private FactoryInterface $productBundleItemFactory, + private FactoryInterface $channelPricingFactory, + private ProductVariantResolverInterface $productVariantResolver, + private SlugGeneratorInterface $slugGenerator + ) {} /** * @Given /^the store has bundled product "([^"]*)" priced at ("[^"]+") which contains "([^"]*)" and "([^"]*)"$/ diff --git a/tests/Behat/Context/Ui/ProductBundleContext.php b/tests/Behat/Context/Ui/ProductBundleContext.php new file mode 100644 index 00000000..41bf8009 --- /dev/null +++ b/tests/Behat/Context/Ui/ProductBundleContext.php @@ -0,0 +1,91 @@ +createBundledProductPage->open(); + } + + /** + * @When I specify its code as :code + */ + public function iSpecifyItsCode(string $code): void + { + $this->createBundledProductPage->specifyCode($code); + } + + /** + * @When I name it :name in :language + */ + public function iRenameItToIn(?string $name = null, ?string $language = null): void + { + if ($name !== null && $language !== null) { + $this->createBundledProductPage->nameItIn($name, $language); + } + } + + /** + * @When I set its slug to :slug + * @When I set its slug to :slug in :language + */ + public function iSetItsSlugToIn(?string $slug = null, $language = 'en_US') + { + $this->createBundledProductPage->specifySlugIn($slug, $language); + } + + /** + * @When /^I set its(?:| default) price to "(?:€|£|\$)([^"]+)" for ("([^"]+)" channel)$/ + */ + public function iSetItsPriceTo(string $price, ChannelInterface $channel) + { + $this->createBundledProductPage->specifyPrice($channel, $price); + } + + /** + * @When /^I set its original price to "(?:€|£|\$)([^"]+)" for ("([^"]+)" channel)$/ + */ + public function iSetItsOriginalPriceTo(int $originalPrice, ChannelInterface $channel) + { + $this->createBundledProductPage->specifyOriginalPrice($channel, $originalPrice); + } + + /** + * @When I add it + */ + public function iAddIt() + { + $this->createBundledProductPage->create(); + } + + /** + * @When I add product :productName to the bundle + * @When I add product :firstProductName and :secondProductName to the bundle + * @When I add product :firstProductName and :secondProductName and :thirdProductName to the bundle + */ + public function iAddProductsToBundledProduct(...$productsNames) + { + $this->createBundledProductPage->addProductsToBundle($productsNames); + } +} diff --git a/tests/Behat/Page/Admin/CreateBundledProductPage.php b/tests/Behat/Page/Admin/CreateBundledProductPage.php new file mode 100644 index 00000000..093a10c1 --- /dev/null +++ b/tests/Behat/Page/Admin/CreateBundledProductPage.php @@ -0,0 +1,131 @@ +getDocument()->fillField('Code', $code); + } + + public function nameItIn(string $name, string $localeCode): void + { + $this->clickTabIfItsNotActive('details'); + $this->activateLanguageTab($localeCode); + $this->getElement('name', ['%locale%' => $localeCode])->setValue($name); + + if (DriverHelper::isJavascript($this->getDriver())) { + SlugGenerationHelper::waitForSlugGeneration( + $this->getSession(), + $this->getElement('slug', ['%locale%' => $localeCode]), + ); + } + } + + public function specifySlugIn(?string $slug, string $locale): void + { + $this->activateLanguageTab($locale); + + $this->getElement('slug', ['%locale%' => $locale])->setValue($slug); + } + + public function activateLanguageTab(string $locale): void + { + if (DriverHelper::isNotJavascript($this->getDriver())) { + return; + } + + $languageTabTitle = $this->getElement('language_tab', ['%locale%' => $locale]); + if (!$languageTabTitle->hasClass('active')) { + $languageTabTitle->click(); + } + } + + public function specifyPrice(ChannelInterface $channel, string $price): void + { + $this->getElement('price', ['%channelCode%' => $channel->getCode()])->setValue($price); + } + + public function specifyOriginalPrice(ChannelInterface $channel, int $originalPrice): void + { + $this->getElement('original_price', ['%channelCode%' => $channel->getCode()])->setValue($originalPrice); + } + + public function addProductsToBundle(array $productsNames): void + { + $this->clickTabIfItsNotActive('bundle'); + + $productCounter = 0; + + foreach ($productsNames as $productName) { + $addSelector = $this->getElement('add_product_to_bundle_button'); + $addSelector->click(); + $addSelector->waitFor(5, fn () => $this->hasElement('product_selector_dropdown')); + + $dropdown = $this->getLastImageElement(); + $dropdown->click(); + $dropdown->waitFor(5, fn () => $this->hasElement('product_selector_dropdown_item')); + + $item = $this->getElement('product_selector_dropdown_item', [ + '%item%' => $productName + ]); + $item->click(); + + $this->getElement('product_selector_quantity', ['%productCounter%' => $productCounter])->setValue('1'); + + $productCounter++; + } + + } + + protected function getDefinedElements(): array + { + return array_merge(parent::getDefinedElements(), [ + 'product_selector_quantity' => '#sylius_product_productBundle_productBundleItems_%productCounter%_quantity', + 'product_selector_dropdown_item' => '#add_product_to_bundle_autocomplete > div > div > div.menu.transition.visible > div.item:contains("%item%")', + 'product_selector_dropdown' => '#add_product_to_bundle_autocomplete', + 'add_product_to_bundle_button' => '#bitbag_add_product_to_bundle_button', + 'code' => '#sylius_product_code', + 'language_tab' => '[data-locale="%locale%"] .title', + 'name' => '#sylius_product_translations_%locale%_name', + 'original_price' => '#sylius_product_variant_channelPricings_%channelCode%_originalPrice', + 'price' => '#sylius_product_variant_channelPricings_%channelCode%_price', + 'slug' => '#sylius_product_translations_%locale%_slug', + 'tab' => '.menu [data-tab="%name%"]', + ]); + } + + private function clickTabIfItsNotActive(string $tabName): void + { + $attributesTab = $this->getElement('tab', ['%name%' => $tabName]); + if (!$attributesTab->hasClass('active')) { + $attributesTab->click(); + } + } + + private function getLastImageElement(): NodeElement + { + $items = $this->getDocument()->findAll('css', '#add_product_to_bundle_autocomplete'); + + Assert::notEmpty($items); + + return end($items); + } + +} diff --git a/tests/Behat/Page/Admin/CreateBundledProductPageInterface.php b/tests/Behat/Page/Admin/CreateBundledProductPageInterface.php new file mode 100644 index 00000000..1d0a8dc3 --- /dev/null +++ b/tests/Behat/Page/Admin/CreateBundledProductPageInterface.php @@ -0,0 +1,22 @@ + Date: Fri, 7 Jul 2023 16:27:40 +0200 Subject: [PATCH 02/22] Update code to PHP 8 standards --- .../AddProductBundleItemToCartCommand.php | 17 ++++-------- src/Command/AddProductBundleToCartCommand.php | 21 +++------------ src/Controller/OrderItemController.php | 25 +++-------------- src/Dto/AddProductBundleToCartDto.php | 24 +++-------------- src/Dto/Api/AddProductBundleToCartDto.php | 19 ++++--------- .../AddProductBundleToCartDtoFactory.php | 10 +++---- src/Factory/OrderItemFactory.php | 10 +++---- src/Factory/ProductBundleOrderItemFactory.php | 10 +++---- src/Factory/ProductFactory.php | 15 +++-------- src/Handler/AddProductBundleToCartHandler.php | 21 +++------------ .../CartProcessor.php | 27 ++++--------------- .../ProductBundleOrderItemExtension.php | 15 +++-------- .../HasAvailableProductBundleValidator.php | 21 +++------------ src/Validator/HasExistingCartValidator.php | 10 +++---- src/Validator/HasProductBundleValidator.php | 10 +++---- src/Validator/Sequentially.php | 7 ++--- 16 files changed, 60 insertions(+), 202 deletions(-) diff --git a/src/Command/AddProductBundleItemToCartCommand.php b/src/Command/AddProductBundleItemToCartCommand.php index d2a8149d..f2cca7b8 100644 --- a/src/Command/AddProductBundleItemToCartCommand.php +++ b/src/Command/AddProductBundleItemToCartCommand.php @@ -15,18 +15,11 @@ final class AddProductBundleItemToCartCommand { - /** @var ProductBundleItemInterface */ - private $productBundleItem; - - /** @var ProductVariantInterface|null */ - private $productVariant; - - /** @var int|null */ - private $quantity; - - public function __construct(ProductBundleItemInterface $productBundleItem) - { - $this->productBundleItem = $productBundleItem; + public function __construct( + private ProductBundleItemInterface $productBundleItem, + private ?ProductVariantInterface $productVariant = null, + private ?int $quantity = null + ) { $this->productVariant = $productBundleItem->getProductVariant(); $this->quantity = $productBundleItem->getQuantity(); } diff --git a/src/Command/AddProductBundleToCartCommand.php b/src/Command/AddProductBundleToCartCommand.php index 7ef3e44c..1e52c6ea 100644 --- a/src/Command/AddProductBundleToCartCommand.php +++ b/src/Command/AddProductBundleToCartCommand.php @@ -12,24 +12,11 @@ final class AddProductBundleToCartCommand implements OrderIdentityAwareInterface, ProductCodeAwareInterface { - /** @var int */ - private $orderId; - - /** @var string */ - private $productCode; - - /** @var int */ - private $quantity; - public function __construct( - int $orderId, - string $productCode, - int $quantity = 1 - ) { - $this->orderId = $orderId; - $this->productCode = $productCode; - $this->quantity = $quantity; - } + private int $orderId, + private string $productCode, + private int $quantity = 1 + ) {} public function getOrderId(): int { diff --git a/src/Controller/OrderItemController.php b/src/Controller/OrderItemController.php index 48859b53..f13d9e82 100644 --- a/src/Controller/OrderItemController.php +++ b/src/Controller/OrderItemController.php @@ -32,18 +32,6 @@ class OrderItemController extends BaseOrderItemController { - /** @var MessageBusInterface */ - protected $messageBus; - - /** @var OrderRepositoryInterface */ - protected $orderRepository; - - /** @var AddProductBundleToCartDtoFactoryInterface */ - private $addProductBundleToCartDtoFactory; - - /** @var AddProductBundleToCartCommandFactoryInterface */ - private $addProductBundleToCartCommandFactory; - public function __construct( MetadataInterface $metadata, Controller\RequestConfigurationFactoryInterface $requestConfigurationFactory, @@ -62,10 +50,10 @@ public function __construct( Controller\StateMachineInterface $stateMachine, Controller\ResourceUpdateHandlerInterface $resourceUpdateHandler, Controller\ResourceDeleteHandlerInterface $resourceDeleteHandler, - MessageBusInterface $messageBus, - OrderRepositoryInterface $orderRepository, - AddProductBundleToCartDtoFactoryInterface $addProductBundleToCartDtoFactory, - AddProductBundleToCartCommandFactoryInterface $addProductBundleToCartCommandFactory + private MessageBusInterface $messageBus, + private OrderRepositoryInterface $orderRepository, + private AddProductBundleToCartDtoFactoryInterface $addProductBundleToCartDtoFactory, + private AddProductBundleToCartCommandFactoryInterface $addProductBundleToCartCommandFactory ) { parent::__construct( $metadata, @@ -86,11 +74,6 @@ public function __construct( $resourceUpdateHandler, $resourceDeleteHandler ); - - $this->messageBus = $messageBus; - $this->orderRepository = $orderRepository; - $this->addProductBundleToCartDtoFactory = $addProductBundleToCartDtoFactory; - $this->addProductBundleToCartCommandFactory = $addProductBundleToCartCommandFactory; } public function addProductBundleAction(Request $request): ?Response diff --git a/src/Dto/AddProductBundleToCartDto.php b/src/Dto/AddProductBundleToCartDto.php index 6a320a13..d72614ba 100644 --- a/src/Dto/AddProductBundleToCartDto.php +++ b/src/Dto/AddProductBundleToCartDto.php @@ -19,30 +19,14 @@ final class AddProductBundleToCartDto implements AddProductBundleToCartDtoInterface, ProductCodeAwareInterface { - /** @var OrderInterface */ - private $cart; + private ArrayCollection|array $productBundleItems; - /** @var OrderItemInterface */ - private $cartItem; - - /** @var ProductInterface */ - private $product; - - /** @var ArrayCollection */ - private $productBundleItems; - - /** - * @param AddProductBundleItemToCartCommand[] $productBundleItems - */ public function __construct( - OrderInterface $cart, - OrderItemInterface $cartItem, - ProductInterface $product, + private OrderInterface $cart, + private OrderItemInterface $cartItem, + private ProductInterface $product, array $productBundleItems ) { - $this->cart = $cart; - $this->cartItem = $cartItem; - $this->product = $product; $this->productBundleItems = new ArrayCollection($productBundleItems); } diff --git a/src/Dto/Api/AddProductBundleToCartDto.php b/src/Dto/Api/AddProductBundleToCartDto.php index dd8d2e85..125d130f 100644 --- a/src/Dto/Api/AddProductBundleToCartDto.php +++ b/src/Dto/Api/AddProductBundleToCartDto.php @@ -14,20 +14,11 @@ final class AddProductBundleToCartDto implements OrderTokenValueAwareInterface { - /** @var string|null */ - private $orderTokenValue; - - /** @var string */ - private $productCode; - - /** @var int */ - private $quantity; - - public function __construct(string $productCode, int $quantity = 1) - { - $this->productCode = $productCode; - $this->quantity = $quantity; - } + public function __construct( + private string $productCode, + private int $quantity = 1, + private ?string $orderTokenValue = null + ) {} public function getOrderTokenValue(): ?string { diff --git a/src/Factory/AddProductBundleToCartDtoFactory.php b/src/Factory/AddProductBundleToCartDtoFactory.php index b53e2012..6f61fd58 100644 --- a/src/Factory/AddProductBundleToCartDtoFactory.php +++ b/src/Factory/AddProductBundleToCartDtoFactory.php @@ -20,13 +20,9 @@ final class AddProductBundleToCartDtoFactory implements AddProductBundleToCartDtoFactoryInterface { - /** @var AddProductBundleItemToCartCommandFactoryInterface */ - private $addProductBundleItemToCartCommandFactory; - - public function __construct(AddProductBundleItemToCartCommandFactoryInterface $addProductBundleItemToCartCommandFactory) - { - $this->addProductBundleItemToCartCommandFactory = $addProductBundleItemToCartCommandFactory; - } + public function __construct( + private AddProductBundleItemToCartCommandFactoryInterface $addProductBundleItemToCartCommandFactory + ) {} public function createNew( OrderInterface $order, diff --git a/src/Factory/OrderItemFactory.php b/src/Factory/OrderItemFactory.php index 38978397..5525dd43 100644 --- a/src/Factory/OrderItemFactory.php +++ b/src/Factory/OrderItemFactory.php @@ -18,13 +18,9 @@ final class OrderItemFactory implements OrderItemFactoryInterface { - /** @var CartItemFactoryInterface */ - private $decoratedFactory; - - public function __construct(CartItemFactoryInterface $decoratedFactory) - { - $this->decoratedFactory = $decoratedFactory; - } + public function __construct( + private CartItemFactoryInterface $decoratedFactory + ) {} public function createNew(): OrderItemInterface { diff --git a/src/Factory/ProductBundleOrderItemFactory.php b/src/Factory/ProductBundleOrderItemFactory.php index cbc883cd..eb203544 100644 --- a/src/Factory/ProductBundleOrderItemFactory.php +++ b/src/Factory/ProductBundleOrderItemFactory.php @@ -16,13 +16,9 @@ final class ProductBundleOrderItemFactory implements ProductBundleOrderItemFactoryInterface { - /** @var FactoryInterface */ - private $decoratedFactory; - - public function __construct(FactoryInterface $decoratedFactory) - { - $this->decoratedFactory = $decoratedFactory; - } + public function __construct( + private FactoryInterface $decoratedFactory + ) {} public function createNew(): ProductBundleOrderItemInterface { diff --git a/src/Factory/ProductFactory.php b/src/Factory/ProductFactory.php index 65e6eef5..84ed8953 100644 --- a/src/Factory/ProductFactory.php +++ b/src/Factory/ProductFactory.php @@ -18,17 +18,10 @@ final class ProductFactory implements ProductFactoryInterface { - /** @var DecoratedProductFactoryInterface */ - private $decoratedFactory; - - /** @var FactoryInterface */ - private $productBundleFactory; - - public function __construct(DecoratedProductFactoryInterface $decoratedFactory, FactoryInterface $productBundleFactory) - { - $this->decoratedFactory = $decoratedFactory; - $this->productBundleFactory = $productBundleFactory; - } + public function __construct( + private DecoratedProductFactoryInterface $decoratedFactory, + private FactoryInterface $productBundleFactory + ) {} public function createWithVariantAndBundle(): BaseProductInterface { diff --git a/src/Handler/AddProductBundleToCartHandler.php b/src/Handler/AddProductBundleToCartHandler.php index 5ae0af0c..b1f6bc4c 100644 --- a/src/Handler/AddProductBundleToCartHandler.php +++ b/src/Handler/AddProductBundleToCartHandler.php @@ -21,24 +21,11 @@ final class AddProductBundleToCartHandler implements MessageHandlerInterface { - /** @var OrderRepositoryInterface */ - private $orderRepository; - - /** @var ProductRepositoryInterface */ - private $productRepository; - - /** @var CartProcessorInterface */ - private $cartProcessor; - public function __construct( - OrderRepositoryInterface $orderRepository, - ProductRepositoryInterface $productRepository, - CartProcessorInterface $cartItemProcessor - ) { - $this->orderRepository = $orderRepository; - $this->productRepository = $productRepository; - $this->cartProcessor = $cartItemProcessor; - } + private OrderRepositoryInterface $orderRepository, + private ProductRepositoryInterface $productRepository, + private CartProcessorInterface $cartProcessor + ) {} public function __invoke(AddProductBundleToCartCommand $addProductBundleToCartCommand): void { diff --git a/src/Handler/AddProductBundleToCartHandler/CartProcessor.php b/src/Handler/AddProductBundleToCartHandler/CartProcessor.php index bb2ffe32..ede6debf 100644 --- a/src/Handler/AddProductBundleToCartHandler/CartProcessor.php +++ b/src/Handler/AddProductBundleToCartHandler/CartProcessor.php @@ -21,29 +21,12 @@ final class CartProcessor implements CartProcessorInterface { - /** @var OrderItemQuantityModifierInterface */ - private $orderItemQuantityModifier; - - /** @var ProductBundleOrderItemFactoryInterface */ - private $productBundleOrderItemFactory; - - /** @var OrderModifierInterface */ - private $orderModifier; - - /** @var OrderItemFactoryInterface */ - private $cartItemFactory; - public function __construct( - OrderItemQuantityModifierInterface $orderItemQuantityModifier, - ProductBundleOrderItemFactoryInterface $productBundleOrderItemFactory, - OrderModifierInterface $orderModifier, - OrderItemFactoryInterface $cartItemFactory - ) { - $this->orderItemQuantityModifier = $orderItemQuantityModifier; - $this->productBundleOrderItemFactory = $productBundleOrderItemFactory; - $this->orderModifier = $orderModifier; - $this->cartItemFactory = $cartItemFactory; - } + private OrderItemQuantityModifierInterface $orderItemQuantityModifier, + private ProductBundleOrderItemFactoryInterface $productBundleOrderItemFactory, + private OrderModifierInterface $orderModifier, + private OrderItemFactoryInterface $cartItemFactory + ) {} public function process( OrderInterface $cart, diff --git a/src/Twig/Extension/ProductBundleOrderItemExtension.php b/src/Twig/Extension/ProductBundleOrderItemExtension.php index d43eb70f..7a8f1243 100644 --- a/src/Twig/Extension/ProductBundleOrderItemExtension.php +++ b/src/Twig/Extension/ProductBundleOrderItemExtension.php @@ -19,17 +19,10 @@ final class ProductBundleOrderItemExtension extends AbstractExtension { - /** @var RepositoryInterface */ - private $productBundleOrderItemRepository; - - /** @var Environment */ - private $twig; - - public function __construct(RepositoryInterface $productBundleOrderItemRepository, Environment $twig) - { - $this->productBundleOrderItemRepository = $productBundleOrderItemRepository; - $this->twig = $twig; - } + public function __construct( + private RepositoryInterface $productBundleOrderItemRepository, + private Environment $twig + ) {} public function getFunctions(): array { diff --git a/src/Validator/HasAvailableProductBundleValidator.php b/src/Validator/HasAvailableProductBundleValidator.php index 9aa902d2..e9935bae 100644 --- a/src/Validator/HasAvailableProductBundleValidator.php +++ b/src/Validator/HasAvailableProductBundleValidator.php @@ -25,24 +25,11 @@ final class HasAvailableProductBundleValidator extends ConstraintValidator { - /** @var ProductRepositoryInterface */ - private $productRepository; - - /** @var OrderRepositoryInterface */ - private $orderRepository; - - /** @var AvailabilityCheckerInterface */ - private $availabilityChecker; - public function __construct( - ProductRepositoryInterface $productRepository, - OrderRepositoryInterface $orderRepository, - AvailabilityCheckerInterface $availabilityChecker - ) { - $this->productRepository = $productRepository; - $this->orderRepository = $orderRepository; - $this->availabilityChecker = $availabilityChecker; - } + private ProductRepositoryInterface $productRepository, + private OrderRepositoryInterface $orderRepository, + private AvailabilityCheckerInterface $availabilityChecker + ) {} /** * @param AddProductBundleToCartCommand|mixed $value diff --git a/src/Validator/HasExistingCartValidator.php b/src/Validator/HasExistingCartValidator.php index 94861df2..bfbc790d 100644 --- a/src/Validator/HasExistingCartValidator.php +++ b/src/Validator/HasExistingCartValidator.php @@ -19,13 +19,9 @@ final class HasExistingCartValidator extends ConstraintValidator { - /** @var OrderRepositoryInterface */ - private $orderRepository; - - public function __construct(OrderRepositoryInterface $orderRepository) - { - $this->orderRepository = $orderRepository; - } + public function __construct( + private OrderRepositoryInterface $orderRepository + ) {} /** * @param OrderIdentityAwareInterface|mixed $value diff --git a/src/Validator/HasProductBundleValidator.php b/src/Validator/HasProductBundleValidator.php index 0b53ee55..b469eb8d 100644 --- a/src/Validator/HasProductBundleValidator.php +++ b/src/Validator/HasProductBundleValidator.php @@ -20,13 +20,9 @@ final class HasProductBundleValidator extends ConstraintValidator { - /** @var ProductRepositoryInterface */ - private $productRepository; - - public function __construct(ProductRepositoryInterface $productRepository) - { - $this->productRepository = $productRepository; - } + public function __construct( + private ProductRepositoryInterface $productRepository + ) {} /** * @param ProductCodeAwareInterface|mixed $value diff --git a/src/Validator/Sequentially.php b/src/Validator/Sequentially.php index c92c6c42..223ac1aa 100644 --- a/src/Validator/Sequentially.php +++ b/src/Validator/Sequentially.php @@ -14,12 +14,9 @@ final class Sequentially extends Composite { - /** @var array */ - public $constraints = []; - - public function __construct(?array $constraints = null) + public function __construct(public ?array $constraints = []) { - parent::__construct($constraints ?? []); + parent::__construct($constraints); } public function getDefaultOption(): string From 76ed17bf4bbd3e2f025f559001c0fe6e66fe100a Mon Sep 17 00:00:00 2001 From: token Date: Fri, 7 Jul 2023 16:39:46 +0200 Subject: [PATCH 03/22] Update gitignore --- .gitignore | 7 ++++++- tests/Application/.gitignore | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5f8e7464..5cefda9b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,12 @@ /tests/Application/yarn.lock +/.phpunit.result.cache /behat.yml /phpspec.yml /phpunit.xml -/.phpunit.result.cache +.phpunit.result.cache + +# Symfony CLI https://symfony.com/doc/current/setup/symfony_server.html#different-php-settings-per-project +/.php-version +/php.ini diff --git a/tests/Application/.gitignore b/tests/Application/.gitignore index 8ad1225e..bc600a8c 100644 --- a/tests/Application/.gitignore +++ b/tests/Application/.gitignore @@ -1,4 +1,5 @@ /public/assets +/public/build /public/css /public/js /public/media/* From 6e1239d99fe39e91cb951fe0f45e67c3b9584130 Mon Sep 17 00:00:00 2001 From: token Date: Fri, 7 Jul 2023 16:40:20 +0200 Subject: [PATCH 04/22] ECS fix --- src/Command/AddProductBundleToCartCommand.php | 3 ++- src/Dto/AddProductBundleToCartDto.php | 1 - src/Dto/Api/AddProductBundleToCartDto.php | 3 ++- src/Factory/AddProductBundleToCartDtoFactory.php | 3 ++- src/Factory/OrderItemFactory.php | 3 ++- src/Factory/ProductBundleOrderItemFactory.php | 3 ++- src/Factory/ProductFactory.php | 3 ++- src/Handler/AddProductBundleToCartHandler.php | 3 ++- src/Handler/AddProductBundleToCartHandler/CartProcessor.php | 3 ++- src/Twig/Extension/ProductBundleOrderItemExtension.php | 3 ++- src/Validator/HasAvailableProductBundleValidator.php | 3 ++- src/Validator/HasExistingCartValidator.php | 3 ++- src/Validator/HasProductBundleValidator.php | 3 ++- 13 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/Command/AddProductBundleToCartCommand.php b/src/Command/AddProductBundleToCartCommand.php index 1e52c6ea..6e100b6b 100644 --- a/src/Command/AddProductBundleToCartCommand.php +++ b/src/Command/AddProductBundleToCartCommand.php @@ -16,7 +16,8 @@ public function __construct( private int $orderId, private string $productCode, private int $quantity = 1 - ) {} + ) { + } public function getOrderId(): int { diff --git a/src/Dto/AddProductBundleToCartDto.php b/src/Dto/AddProductBundleToCartDto.php index d72614ba..7c9af7ea 100644 --- a/src/Dto/AddProductBundleToCartDto.php +++ b/src/Dto/AddProductBundleToCartDto.php @@ -10,7 +10,6 @@ namespace BitBag\SyliusProductBundlePlugin\Dto; -use BitBag\SyliusProductBundlePlugin\Command\AddProductBundleItemToCartCommand; use BitBag\SyliusProductBundlePlugin\Command\ProductCodeAwareInterface; use BitBag\SyliusProductBundlePlugin\Entity\ProductInterface; use Doctrine\Common\Collections\ArrayCollection; diff --git a/src/Dto/Api/AddProductBundleToCartDto.php b/src/Dto/Api/AddProductBundleToCartDto.php index 125d130f..4d96771c 100644 --- a/src/Dto/Api/AddProductBundleToCartDto.php +++ b/src/Dto/Api/AddProductBundleToCartDto.php @@ -18,7 +18,8 @@ public function __construct( private string $productCode, private int $quantity = 1, private ?string $orderTokenValue = null - ) {} + ) { + } public function getOrderTokenValue(): ?string { diff --git a/src/Factory/AddProductBundleToCartDtoFactory.php b/src/Factory/AddProductBundleToCartDtoFactory.php index 6f61fd58..b5277347 100644 --- a/src/Factory/AddProductBundleToCartDtoFactory.php +++ b/src/Factory/AddProductBundleToCartDtoFactory.php @@ -22,7 +22,8 @@ final class AddProductBundleToCartDtoFactory implements AddProductBundleToCartDt { public function __construct( private AddProductBundleItemToCartCommandFactoryInterface $addProductBundleItemToCartCommandFactory - ) {} + ) { + } public function createNew( OrderInterface $order, diff --git a/src/Factory/OrderItemFactory.php b/src/Factory/OrderItemFactory.php index 5525dd43..b959ff98 100644 --- a/src/Factory/OrderItemFactory.php +++ b/src/Factory/OrderItemFactory.php @@ -20,7 +20,8 @@ final class OrderItemFactory implements OrderItemFactoryInterface { public function __construct( private CartItemFactoryInterface $decoratedFactory - ) {} + ) { + } public function createNew(): OrderItemInterface { diff --git a/src/Factory/ProductBundleOrderItemFactory.php b/src/Factory/ProductBundleOrderItemFactory.php index eb203544..c54bc5b5 100644 --- a/src/Factory/ProductBundleOrderItemFactory.php +++ b/src/Factory/ProductBundleOrderItemFactory.php @@ -18,7 +18,8 @@ final class ProductBundleOrderItemFactory implements ProductBundleOrderItemFacto { public function __construct( private FactoryInterface $decoratedFactory - ) {} + ) { + } public function createNew(): ProductBundleOrderItemInterface { diff --git a/src/Factory/ProductFactory.php b/src/Factory/ProductFactory.php index 84ed8953..08507701 100644 --- a/src/Factory/ProductFactory.php +++ b/src/Factory/ProductFactory.php @@ -21,7 +21,8 @@ final class ProductFactory implements ProductFactoryInterface public function __construct( private DecoratedProductFactoryInterface $decoratedFactory, private FactoryInterface $productBundleFactory - ) {} + ) { + } public function createWithVariantAndBundle(): BaseProductInterface { diff --git a/src/Handler/AddProductBundleToCartHandler.php b/src/Handler/AddProductBundleToCartHandler.php index b1f6bc4c..e0caed6d 100644 --- a/src/Handler/AddProductBundleToCartHandler.php +++ b/src/Handler/AddProductBundleToCartHandler.php @@ -25,7 +25,8 @@ public function __construct( private OrderRepositoryInterface $orderRepository, private ProductRepositoryInterface $productRepository, private CartProcessorInterface $cartProcessor - ) {} + ) { + } public function __invoke(AddProductBundleToCartCommand $addProductBundleToCartCommand): void { diff --git a/src/Handler/AddProductBundleToCartHandler/CartProcessor.php b/src/Handler/AddProductBundleToCartHandler/CartProcessor.php index ede6debf..9cb4dd87 100644 --- a/src/Handler/AddProductBundleToCartHandler/CartProcessor.php +++ b/src/Handler/AddProductBundleToCartHandler/CartProcessor.php @@ -26,7 +26,8 @@ public function __construct( private ProductBundleOrderItemFactoryInterface $productBundleOrderItemFactory, private OrderModifierInterface $orderModifier, private OrderItemFactoryInterface $cartItemFactory - ) {} + ) { + } public function process( OrderInterface $cart, diff --git a/src/Twig/Extension/ProductBundleOrderItemExtension.php b/src/Twig/Extension/ProductBundleOrderItemExtension.php index 7a8f1243..fcb3fd2f 100644 --- a/src/Twig/Extension/ProductBundleOrderItemExtension.php +++ b/src/Twig/Extension/ProductBundleOrderItemExtension.php @@ -22,7 +22,8 @@ final class ProductBundleOrderItemExtension extends AbstractExtension public function __construct( private RepositoryInterface $productBundleOrderItemRepository, private Environment $twig - ) {} + ) { + } public function getFunctions(): array { diff --git a/src/Validator/HasAvailableProductBundleValidator.php b/src/Validator/HasAvailableProductBundleValidator.php index e9935bae..c22a119e 100644 --- a/src/Validator/HasAvailableProductBundleValidator.php +++ b/src/Validator/HasAvailableProductBundleValidator.php @@ -29,7 +29,8 @@ public function __construct( private ProductRepositoryInterface $productRepository, private OrderRepositoryInterface $orderRepository, private AvailabilityCheckerInterface $availabilityChecker - ) {} + ) { + } /** * @param AddProductBundleToCartCommand|mixed $value diff --git a/src/Validator/HasExistingCartValidator.php b/src/Validator/HasExistingCartValidator.php index bfbc790d..75d39d0c 100644 --- a/src/Validator/HasExistingCartValidator.php +++ b/src/Validator/HasExistingCartValidator.php @@ -21,7 +21,8 @@ final class HasExistingCartValidator extends ConstraintValidator { public function __construct( private OrderRepositoryInterface $orderRepository - ) {} + ) { + } /** * @param OrderIdentityAwareInterface|mixed $value diff --git a/src/Validator/HasProductBundleValidator.php b/src/Validator/HasProductBundleValidator.php index b469eb8d..58a4c4cb 100644 --- a/src/Validator/HasProductBundleValidator.php +++ b/src/Validator/HasProductBundleValidator.php @@ -22,7 +22,8 @@ final class HasProductBundleValidator extends ConstraintValidator { public function __construct( private ProductRepositoryInterface $productRepository - ) {} + ) { + } /** * @param ProductCodeAwareInterface|mixed $value From 108117d4225d94e58ad92ed43b05c182349ba76e Mon Sep 17 00:00:00 2001 From: token Date: Fri, 7 Jul 2023 16:44:29 +0200 Subject: [PATCH 05/22] ECS fix --- tests/Behat/Context/Setup/ProductBundleContext.php | 3 ++- tests/Behat/Context/Ui/ProductBundleContext.php | 5 +++-- tests/Behat/Page/Admin/CreateBundledProductPage.php | 6 ++---- .../Behat/Page/Admin/CreateBundledProductPageInterface.php | 3 ++- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/Behat/Context/Setup/ProductBundleContext.php b/tests/Behat/Context/Setup/ProductBundleContext.php index 9005a3d9..cbd157f6 100644 --- a/tests/Behat/Context/Setup/ProductBundleContext.php +++ b/tests/Behat/Context/Setup/ProductBundleContext.php @@ -40,7 +40,8 @@ public function __construct( private FactoryInterface $channelPricingFactory, private ProductVariantResolverInterface $productVariantResolver, private SlugGeneratorInterface $slugGenerator - ) {} + ) { + } /** * @Given /^the store has bundled product "([^"]*)" priced at ("[^"]+") which contains "([^"]*)" and "([^"]*)"$/ diff --git a/tests/Behat/Context/Ui/ProductBundleContext.php b/tests/Behat/Context/Ui/ProductBundleContext.php index 41bf8009..85f4429d 100644 --- a/tests/Behat/Context/Ui/ProductBundleContext.php +++ b/tests/Behat/Context/Ui/ProductBundleContext.php @@ -18,7 +18,8 @@ class ProductBundleContext implements Context { public function __construct( private CreateBundledProductPageInterface $createBundledProductPage, - ) {} + ) { + } /** * @When I want to create a new bundled product @@ -41,7 +42,7 @@ public function iSpecifyItsCode(string $code): void */ public function iRenameItToIn(?string $name = null, ?string $language = null): void { - if ($name !== null && $language !== null) { + if (null !== $name && null !== $language) { $this->createBundledProductPage->nameItIn($name, $language); } } diff --git a/tests/Behat/Page/Admin/CreateBundledProductPage.php b/tests/Behat/Page/Admin/CreateBundledProductPage.php index 093a10c1..dfe3d95b 100644 --- a/tests/Behat/Page/Admin/CreateBundledProductPage.php +++ b/tests/Behat/Page/Admin/CreateBundledProductPage.php @@ -83,15 +83,14 @@ public function addProductsToBundle(array $productsNames): void $dropdown->waitFor(5, fn () => $this->hasElement('product_selector_dropdown_item')); $item = $this->getElement('product_selector_dropdown_item', [ - '%item%' => $productName + '%item%' => $productName, ]); $item->click(); $this->getElement('product_selector_quantity', ['%productCounter%' => $productCounter])->setValue('1'); - $productCounter++; + ++$productCounter; } - } protected function getDefinedElements(): array @@ -127,5 +126,4 @@ private function getLastImageElement(): NodeElement return end($items); } - } diff --git a/tests/Behat/Page/Admin/CreateBundledProductPageInterface.php b/tests/Behat/Page/Admin/CreateBundledProductPageInterface.php index 1d0a8dc3..d7c4250a 100644 --- a/tests/Behat/Page/Admin/CreateBundledProductPageInterface.php +++ b/tests/Behat/Page/Admin/CreateBundledProductPageInterface.php @@ -1,10 +1,11 @@ Date: Fri, 7 Jul 2023 17:18:05 +0200 Subject: [PATCH 06/22] PHPstan fix --- src/Dto/AddProductBundleToCartDto.php | 2 +- src/Validator/Sequentially.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Dto/AddProductBundleToCartDto.php b/src/Dto/AddProductBundleToCartDto.php index 7c9af7ea..fb40c854 100644 --- a/src/Dto/AddProductBundleToCartDto.php +++ b/src/Dto/AddProductBundleToCartDto.php @@ -18,7 +18,7 @@ final class AddProductBundleToCartDto implements AddProductBundleToCartDtoInterface, ProductCodeAwareInterface { - private ArrayCollection|array $productBundleItems; + private ArrayCollection $productBundleItems; public function __construct( private OrderInterface $cart, diff --git a/src/Validator/Sequentially.php b/src/Validator/Sequentially.php index 223ac1aa..ce95d6f9 100644 --- a/src/Validator/Sequentially.php +++ b/src/Validator/Sequentially.php @@ -14,9 +14,9 @@ final class Sequentially extends Composite { - public function __construct(public ?array $constraints = []) + public function __construct(public ?array $constraints = null) { - parent::__construct($constraints); + parent::__construct($constraints ?? []); } public function getDefaultOption(): string From 66aa1e539689d7d60b533149b9a6ad37fbb9962d Mon Sep 17 00:00:00 2001 From: token Date: Fri, 7 Jul 2023 17:26:42 +0200 Subject: [PATCH 07/22] PHPstan fix --- src/Validator/SequentiallyValidator.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Validator/SequentiallyValidator.php b/src/Validator/SequentiallyValidator.php index de83a512..057eeb58 100644 --- a/src/Validator/SequentiallyValidator.php +++ b/src/Validator/SequentiallyValidator.php @@ -28,9 +28,11 @@ public function validate(mixed $value, Constraint $constraint): void $originalCount = $validator->getViolations()->count(); - foreach ($constraint->constraints as $c) { - if ($originalCount !== $validator->validate($value, $c)->getViolations()->count()) { - break; + if (is_iterable($constraint->constraints)) { + foreach ($constraint->constraints as $c) { + if ($originalCount !== $validator->validate($value, $c)->getViolations()->count()) { + break; + } } } } From c997cab826e595774d24107d7c2f5cde3cc70c40 Mon Sep 17 00:00:00 2001 From: token Date: Tue, 25 Jul 2023 18:07:54 +0200 Subject: [PATCH 08/22] Create seperate package.json versions for Sylius 1.11 and 1.12 --- .github/workflows/build.yml | 5 +++ tests/Application/package.json.~1.11.0.dist | 39 ++++++++++++++++++ tests/Application/package.json.~1.12.0.dist | 44 +++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 tests/Application/package.json.~1.11.0.dist create mode 100644 tests/Application/package.json.~1.12.0.dist diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d5cf14c5..f12ee2cb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -124,6 +124,11 @@ jobs: restore-keys: | ${{ runner.os }}-node-${{ matrix.node }}-yarn- + - + name: Copy package.json.dist to package.json + if: matrix.sylius != '' + run: (cd tests/Application && cp package.json.\${{ matrix.sylius }}.dist package.json) + - name: Install JS dependencies run: (cd tests/Application && yarn install) diff --git a/tests/Application/package.json.~1.11.0.dist b/tests/Application/package.json.~1.11.0.dist new file mode 100644 index 00000000..3d97a4fe --- /dev/null +++ b/tests/Application/package.json.~1.11.0.dist @@ -0,0 +1,39 @@ +{ + "dependencies": { + "babel-polyfill": "^6.26.0", + "chart.js": "^2.9.3", + "jquery": "^3.4.0", + "jquery.dirtyforms": "^2.0.0", + "lightbox2": "^2.9.0", + "semantic-ui-css": "^2.2.0", + "slick-carousel": "^1.8.1" + }, + "devDependencies": { + "@symfony/webpack-encore": "^1.6.1", + "babel-core": "^6.26.3", + "babel-plugin-external-helpers": "^6.22.0", + "babel-plugin-module-resolver": "^3.1.1", + "babel-plugin-transform-object-rest-spread": "^6.26.0", + "babel-preset-env": "^1.7.0", + "babel-register": "^6.26.0", + "dedent": "^0.7.0", + "eslint": "^4.19.1", + "eslint-config-airbnb-base": "^12.1.0", + "eslint-import-resolver-babel-module": "^4.0.0", + "eslint-plugin-import": "^2.11.0", + "merge-stream": "^1.0.0", + "sass": "^1.39.2", + "sass-loader": "^12.1.0" + }, + "scripts": { + "dev": "yarn encore dev", + "watch": "yarn encore dev --watch", + "prod": "yarn encore prod" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Sylius/Sylius.git" + }, + "author": "Paweł Jędrzejewski", + "license": "MIT" +} diff --git a/tests/Application/package.json.~1.12.0.dist b/tests/Application/package.json.~1.12.0.dist new file mode 100644 index 00000000..16de6eea --- /dev/null +++ b/tests/Application/package.json.~1.12.0.dist @@ -0,0 +1,44 @@ +{ + "dependencies": { + "babel-polyfill": "^6.26.0", + "jquery": "^3.4.0", + "jquery.dirtyforms": "^2.0.0", + "lightbox2": "^2.9.0", + "semantic-ui-css": "^2.2.0", + "slick-carousel": "^1.8.1", + "chart.js": "^3.7.1" + }, + "devDependencies": { + "@symfony/webpack-encore": "^1.6.1", + "babel-core": "^6.26.3", + "babel-plugin-external-helpers": "^6.22.0", + "babel-plugin-module-resolver": "^3.1.1", + "babel-plugin-transform-object-rest-spread": "^6.26.0", + "babel-preset-env": "^1.7.0", + "babel-register": "^6.26.0", + "dedent": "^0.7.0", + "eslint": "^4.19.1", + "eslint-config-airbnb-base": "^12.1.0", + "eslint-import-resolver-babel-module": "^4.0.0", + "eslint-plugin-import": "^2.11.0", + "fast-async": "^6.3.7", + "merge-stream": "^1.0.0", + "sass": "^1.50.0", + "sass-loader": "^7.0.1", + "upath": "^1.1.0", + "webpack": "^5.76.1", + "yargs": "^6.4.0" + }, + "scripts": { + "build": "encore production", + "dev": "encore dev", + "lint": "yarn lint:js", + "lint:js": "eslint gulpfile.babel.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Sylius/Sylius.git" + }, + "author": "Paweł Jędrzejewski", + "license": "MIT" +} From 5e9934d1452974dfc9b5ebde1f24236eab42e575 Mon Sep 17 00:00:00 2001 From: token Date: Tue, 25 Jul 2023 18:15:53 +0200 Subject: [PATCH 09/22] Change frontend package versions for 1.11 --- tests/Application/package.json.~1.11.0.dist | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/Application/package.json.~1.11.0.dist b/tests/Application/package.json.~1.11.0.dist index 3d97a4fe..9ca35627 100644 --- a/tests/Application/package.json.~1.11.0.dist +++ b/tests/Application/package.json.~1.11.0.dist @@ -1,8 +1,8 @@ { "dependencies": { - "babel-polyfill": "^6.26.0", + "@babel/polyfill": "^7.0.0", "chart.js": "^2.9.3", - "jquery": "^3.4.0", + "jquery": "^3.5.0", "jquery.dirtyforms": "^2.0.0", "lightbox2": "^2.9.0", "semantic-ui-css": "^2.2.0", @@ -28,7 +28,9 @@ "scripts": { "dev": "yarn encore dev", "watch": "yarn encore dev --watch", - "prod": "yarn encore prod" + "prod": "yarn encore prod", + "lint": "yarn lint:js", + "lint:js": "eslint gulpfile.babel.js" }, "repository": { "type": "git", From 231f07336b9c5a6bafd875520e38f0cc000aaade Mon Sep 17 00:00:00 2001 From: token Date: Tue, 25 Jul 2023 18:20:22 +0200 Subject: [PATCH 10/22] Change chart.js version --- tests/Application/package.json.~1.11.0.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Application/package.json.~1.11.0.dist b/tests/Application/package.json.~1.11.0.dist index 9ca35627..9f924752 100644 --- a/tests/Application/package.json.~1.11.0.dist +++ b/tests/Application/package.json.~1.11.0.dist @@ -1,7 +1,7 @@ { "dependencies": { "@babel/polyfill": "^7.0.0", - "chart.js": "^2.9.3", + "chart.js": "^2.9.4", "jquery": "^3.5.0", "jquery.dirtyforms": "^2.0.0", "lightbox2": "^2.9.0", From 9b321fb703f4b98442ec00e02744ce379f5286ff Mon Sep 17 00:00:00 2001 From: token Date: Tue, 25 Jul 2023 18:28:39 +0200 Subject: [PATCH 11/22] Remove package.json --- tests/Application/package.json | 44 ---------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 tests/Application/package.json diff --git a/tests/Application/package.json b/tests/Application/package.json deleted file mode 100644 index 16de6eea..00000000 --- a/tests/Application/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "dependencies": { - "babel-polyfill": "^6.26.0", - "jquery": "^3.4.0", - "jquery.dirtyforms": "^2.0.0", - "lightbox2": "^2.9.0", - "semantic-ui-css": "^2.2.0", - "slick-carousel": "^1.8.1", - "chart.js": "^3.7.1" - }, - "devDependencies": { - "@symfony/webpack-encore": "^1.6.1", - "babel-core": "^6.26.3", - "babel-plugin-external-helpers": "^6.22.0", - "babel-plugin-module-resolver": "^3.1.1", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-preset-env": "^1.7.0", - "babel-register": "^6.26.0", - "dedent": "^0.7.0", - "eslint": "^4.19.1", - "eslint-config-airbnb-base": "^12.1.0", - "eslint-import-resolver-babel-module": "^4.0.0", - "eslint-plugin-import": "^2.11.0", - "fast-async": "^6.3.7", - "merge-stream": "^1.0.0", - "sass": "^1.50.0", - "sass-loader": "^7.0.1", - "upath": "^1.1.0", - "webpack": "^5.76.1", - "yargs": "^6.4.0" - }, - "scripts": { - "build": "encore production", - "dev": "encore dev", - "lint": "yarn lint:js", - "lint:js": "eslint gulpfile.babel.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Sylius/Sylius.git" - }, - "author": "Paweł Jędrzejewski", - "license": "MIT" -} From 1e68effba58d6350058ca74d8e3cc21268b9df2c Mon Sep 17 00:00:00 2001 From: token Date: Wed, 26 Jul 2023 10:46:01 +0200 Subject: [PATCH 12/22] Change node version --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f12ee2cb..d7c836ba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: php: [8.0] symfony: [^5.4, ^6.0] sylius: [~1.11.0, ~1.12.0] - node: [14.x] + node: [14.20] mysql: [5.7, 8.0] exclude: From 0e076a94960fd0f7a6a259db71e26f1428e54640 Mon Sep 17 00:00:00 2001 From: token Date: Wed, 26 Jul 2023 10:52:32 +0200 Subject: [PATCH 13/22] Change chart.js version --- tests/Application/package.json.~1.11.0.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Application/package.json.~1.11.0.dist b/tests/Application/package.json.~1.11.0.dist index 9f924752..36e6c1f0 100644 --- a/tests/Application/package.json.~1.11.0.dist +++ b/tests/Application/package.json.~1.11.0.dist @@ -1,7 +1,7 @@ { "dependencies": { "@babel/polyfill": "^7.0.0", - "chart.js": "^2.9.4", + "chart.js": "^3.7.1", "jquery": "^3.5.0", "jquery.dirtyforms": "^2.0.0", "lightbox2": "^2.9.0", From 75a0dad1ad7daa5e1e93561fe1303e8d88c31c47 Mon Sep 17 00:00:00 2001 From: token Date: Wed, 26 Jul 2023 11:23:42 +0200 Subject: [PATCH 14/22] Change behat steps --- features/having_bundled_product_in_store.feature | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/features/having_bundled_product_in_store.feature b/features/having_bundled_product_in_store.feature index e72f8e94..1e9031d2 100644 --- a/features/having_bundled_product_in_store.feature +++ b/features/having_bundled_product_in_store.feature @@ -25,8 +25,7 @@ Feature: Having a product in store which is a bundle of other products And the store has bundled product "Jim Beam double pack" priced at "$18.00" which contains "Jim Beam" and "Jim Beam Double Oak" And all store products appear under a main taxonomy Then I added product "Jim Beam double pack" to the cart - And I specify product "Jim Beam double pack" quantity to 5 - And I should be on my cart summary page + And I change product "Jim Beam double pack" quantity to 5 in my cart And I should see "Jim Beam double pack" with quantity 5 in my cart @ui From 991b691624516c0c0248bf83aa55abfcf1d1ca45 Mon Sep 17 00:00:00 2001 From: token Date: Wed, 26 Jul 2023 11:32:02 +0200 Subject: [PATCH 15/22] Add missing package --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 904c91d4..4bd058ce 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,8 @@ "friendsofphp/php-cs-fixer": "^3.0", "bitbag/coding-standard": "^1.0", "lchrusciel/api-test-case": "^5.1", - "polishsymfonycommunity/symfony-mocker-container": "^1.0" + "polishsymfonycommunity/symfony-mocker-container": "^1.0", + "php-http/message-factory": "^1.1" }, "conflict": { "doctrine/dbal": "^3.0", From 69367150d35aeaee3c71762adf703acfb7a36e13 Mon Sep 17 00:00:00 2001 From: token Date: Wed, 26 Jul 2023 11:42:11 +0200 Subject: [PATCH 16/22] Comment waiting for slug generation --- tests/Behat/Page/Admin/CreateBundledProductPage.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Behat/Page/Admin/CreateBundledProductPage.php b/tests/Behat/Page/Admin/CreateBundledProductPage.php index dfe3d95b..83fcf2df 100644 --- a/tests/Behat/Page/Admin/CreateBundledProductPage.php +++ b/tests/Behat/Page/Admin/CreateBundledProductPage.php @@ -30,12 +30,12 @@ public function nameItIn(string $name, string $localeCode): void $this->activateLanguageTab($localeCode); $this->getElement('name', ['%locale%' => $localeCode])->setValue($name); - if (DriverHelper::isJavascript($this->getDriver())) { - SlugGenerationHelper::waitForSlugGeneration( - $this->getSession(), - $this->getElement('slug', ['%locale%' => $localeCode]), - ); - } +// if (DriverHelper::isJavascript($this->getDriver())) { +// SlugGenerationHelper::waitForSlugGeneration( +// $this->getSession(), +// $this->getElement('slug', ['%locale%' => $localeCode]), +// ); +// } } public function specifySlugIn(?string $slug, string $locale): void From 5da6ddaa150ce2c149c6940dc54ef82c1697f28e Mon Sep 17 00:00:00 2001 From: token Date: Wed, 26 Jul 2023 12:52:15 +0200 Subject: [PATCH 17/22] Trying to fix build --- tests/Behat/Page/Admin/CreateBundledProductPage.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/Behat/Page/Admin/CreateBundledProductPage.php b/tests/Behat/Page/Admin/CreateBundledProductPage.php index 83fcf2df..52aec07f 100644 --- a/tests/Behat/Page/Admin/CreateBundledProductPage.php +++ b/tests/Behat/Page/Admin/CreateBundledProductPage.php @@ -29,13 +29,6 @@ public function nameItIn(string $name, string $localeCode): void $this->clickTabIfItsNotActive('details'); $this->activateLanguageTab($localeCode); $this->getElement('name', ['%locale%' => $localeCode])->setValue($name); - -// if (DriverHelper::isJavascript($this->getDriver())) { -// SlugGenerationHelper::waitForSlugGeneration( -// $this->getSession(), -// $this->getElement('slug', ['%locale%' => $localeCode]), -// ); -// } } public function specifySlugIn(?string $slug, string $locale): void @@ -78,7 +71,7 @@ public function addProductsToBundle(array $productsNames): void $addSelector->click(); $addSelector->waitFor(5, fn () => $this->hasElement('product_selector_dropdown')); - $dropdown = $this->getLastImageElement(); + $dropdown = $this->getLastProductAutocomplete(); $dropdown->click(); $dropdown->waitFor(5, fn () => $this->hasElement('product_selector_dropdown_item')); @@ -118,9 +111,9 @@ private function clickTabIfItsNotActive(string $tabName): void } } - private function getLastImageElement(): NodeElement + private function getLastProductAutocomplete(): NodeElement { - $items = $this->getDocument()->findAll('css', '#add_product_to_bundle_autocomplete'); + $items = $this->getDocument()->findAll('css', '#add_product_to_bundle_autocomplete_xyz'); Assert::notEmpty($items); From 7f96babaed28923392c573ba7878217ea064445e Mon Sep 17 00:00:00 2001 From: token Date: Wed, 26 Jul 2023 12:57:45 +0200 Subject: [PATCH 18/22] ECS fix --- tests/Behat/Page/Admin/CreateBundledProductPage.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Behat/Page/Admin/CreateBundledProductPage.php b/tests/Behat/Page/Admin/CreateBundledProductPage.php index 52aec07f..00a03293 100644 --- a/tests/Behat/Page/Admin/CreateBundledProductPage.php +++ b/tests/Behat/Page/Admin/CreateBundledProductPage.php @@ -13,7 +13,6 @@ use Behat\Mink\Element\NodeElement; use Sylius\Behat\Page\Admin\Crud\CreatePage; use Sylius\Behat\Service\DriverHelper; -use Sylius\Behat\Service\SlugGenerationHelper; use Sylius\Component\Core\Model\ChannelInterface; use Webmozart\Assert\Assert; From 65eb03957d05c99dffd73ded4b4e6df30128ccfb Mon Sep 17 00:00:00 2001 From: token Date: Wed, 26 Jul 2023 13:49:42 +0200 Subject: [PATCH 19/22] Fix webpack config --- composer.json | 4 ++-- tests/Application/config/bundles.php | 1 + tests/Application/config/packages/assets.yaml | 11 +++++++++++ tests/Application/config/packages/webpack_encore.yaml | 4 ++-- tests/Application/config/sylius/1.11/bundles.php | 1 - tests/Application/config/sylius/1.12/bundles.php | 1 - .../bundles/SyliusAdminBundle/Layout/_logo.html.twig | 5 +++++ .../bundles/SyliusAdminBundle/_scripts.html.twig | 2 ++ .../bundles/SyliusAdminBundle/_styles.html.twig | 2 ++ .../SyliusShopBundle/Layout/Header/_logo.html.twig | 5 +++++ .../bundles/SyliusShopBundle/_scripts.html.twig | 2 ++ .../bundles/SyliusShopBundle/_styles.html.twig | 2 ++ tests/Application/webpack.config.js | 4 ++-- webpack.config.js | 2 +- 14 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 tests/Application/config/packages/assets.yaml create mode 100644 tests/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig create mode 100644 tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig create mode 100644 tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig create mode 100644 tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig create mode 100644 tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig create mode 100644 tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig diff --git a/composer.json b/composer.json index 4bd058ce..84bfc748 100644 --- a/composer.json +++ b/composer.json @@ -6,11 +6,11 @@ "license": "MIT", "require": { "php": "^8.0", - "sylius/sylius": "~1.11.0 || ~1.12.0" + "sylius/sylius": "~1.11.0 || ~1.12.0", + "symfony/webpack-encore-bundle": "^1.12" }, "require-dev": { "ext-json": "*", - "symfony/webpack-encore-bundle": "^1.15", "behat/behat": "^3.6.1", "behat/mink-selenium2-driver": "^1.4", "dmore/behat-chrome-extension": "^1.3", diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index 414b2e59..2c74f6f6 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -62,4 +62,5 @@ BitBag\SyliusProductBundlePlugin\BitBagSyliusProductBundlePlugin::class => ['all' => true], Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['test' => true], Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['test' => true], + Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/packages/assets.yaml b/tests/Application/config/packages/assets.yaml new file mode 100644 index 00000000..a7b133d0 --- /dev/null +++ b/tests/Application/config/packages/assets.yaml @@ -0,0 +1,11 @@ +framework: + assets: + packages: + shop: + json_manifest_path: '%kernel.project_dir%/public/build/shop/manifest.json' + admin: + json_manifest_path: '%kernel.project_dir%/public/build/admin/manifest.json' + product_bundle_shop: + json_manifest_path: '%kernel.project_dir%/public/build/bitbag/productBundle/shop/manifest.json' + product_bundle_admin: + json_manifest_path: '%kernel.project_dir%/public/build/bitbag/productBundle/admin/manifest.json' diff --git a/tests/Application/config/packages/webpack_encore.yaml b/tests/Application/config/packages/webpack_encore.yaml index 80beb76c..33196059 100644 --- a/tests/Application/config/packages/webpack_encore.yaml +++ b/tests/Application/config/packages/webpack_encore.yaml @@ -3,5 +3,5 @@ webpack_encore: builds: shop: '%kernel.project_dir%/public/build/shop' admin: '%kernel.project_dir%/public/build/admin' - cs_shop: '%kernel.project_dir%/public/build/bitbag/cs/shop' - cs_admin: '%kernel.project_dir%/public/build/bitbag/cs/admin' + product_bundle_shop: '%kernel.project_dir%/public/build/bitbag/productBundle/shop' + product_bundle_admin: '%kernel.project_dir%/public/build/bitbag/productBundle/admin' diff --git a/tests/Application/config/sylius/1.11/bundles.php b/tests/Application/config/sylius/1.11/bundles.php index aa8974a9..9c9733b1 100644 --- a/tests/Application/config/sylius/1.11/bundles.php +++ b/tests/Application/config/sylius/1.11/bundles.php @@ -10,7 +10,6 @@ $bundles = [ Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], - Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], ]; if (class_exists('BabDev\PagerfantaBundle\BabDevPagerfantaBundle')) { diff --git a/tests/Application/config/sylius/1.12/bundles.php b/tests/Application/config/sylius/1.12/bundles.php index 82a796e6..46a29947 100644 --- a/tests/Application/config/sylius/1.12/bundles.php +++ b/tests/Application/config/sylius/1.12/bundles.php @@ -10,7 +10,6 @@ return [ League\FlysystemBundle\FlysystemBundle::class => ['all' => true], - Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig new file mode 100644 index 00000000..1d9fa7d0 --- /dev/null +++ b/tests/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig @@ -0,0 +1,5 @@ + +
+ +
+
diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig new file mode 100644 index 00000000..54be86fa --- /dev/null +++ b/tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig @@ -0,0 +1,2 @@ +{{ encore_entry_script_tags('admin-entry', null, 'admin') }} +{{ encore_entry_script_tags('bitbag-productBundle-admin', null, 'product_bundle_admin') }} diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig new file mode 100644 index 00000000..d87343da --- /dev/null +++ b/tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig @@ -0,0 +1,2 @@ +{{ encore_entry_link_tags('admin-entry', null, 'admin') }} +{{ encore_entry_link_tags('bitbag-productBundle-admin', null, 'product_bundle_admin') }} diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig new file mode 100644 index 00000000..84b8df56 --- /dev/null +++ b/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig @@ -0,0 +1,5 @@ + diff --git a/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig new file mode 100644 index 00000000..278c091e --- /dev/null +++ b/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig @@ -0,0 +1,2 @@ +{{ encore_entry_script_tags('shop-entry', null, 'shop') }} +{{ encore_entry_script_tags('bitbag-productBundle-shop', null, 'product_bundle_shop') }} diff --git a/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig new file mode 100644 index 00000000..5365a60e --- /dev/null +++ b/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig @@ -0,0 +1,2 @@ +{{ encore_entry_link_tags('shop-entry', null, 'shop') }} +{{ encore_entry_link_tags('bitbag-productBundle-shop', null, 'product_bundle_shop') }} diff --git a/tests/Application/webpack.config.js b/tests/Application/webpack.config.js index be0fe917..8bbcb1a9 100644 --- a/tests/Application/webpack.config.js +++ b/tests/Application/webpack.config.js @@ -1,6 +1,6 @@ const path = require('path'); const Encore = require('@symfony/webpack-encore'); -const [bitbagCsShop, bitbagCsAdmin] = require('../../webpack.config.js'); +const [bitbagProductBundleShop, bitbagProductBundleAdmin] = require('../../webpack.config.js'); const syliusBundles = path.resolve(__dirname, '../../vendor/sylius/sylius/src/Sylius/Bundle/'); const uiBundleScripts = path.resolve(syliusBundles, 'UiBundle/Resources/private/js/'); @@ -44,4 +44,4 @@ adminConfig.resolve.alias['chart.js/dist/Chart.min'] = path.resolve(__dirname, ' adminConfig.externals = Object.assign({}, adminConfig.externals, {window: 'window', document: 'document'}); adminConfig.name = 'admin'; -module.exports = [shopConfig, adminConfig, bitbagCsShop, bitbagCsAdmin]; +module.exports = [shopConfig, adminConfig, bitbagProductBundleShop, bitbagProductBundleAdmin]; diff --git a/webpack.config.js b/webpack.config.js index 943ae658..69deec05 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,6 @@ const path = require('path'); const Encore = require('@symfony/webpack-encore'); -const pluginName = 'cs'; +const pluginName = 'productBundle'; const getConfig = (pluginName, type) => { Encore.reset(); From 5e1666ad04bdab51b1ff85ea54dd4e07cdbd3c8f Mon Sep 17 00:00:00 2001 From: token Date: Wed, 26 Jul 2023 13:50:34 +0200 Subject: [PATCH 20/22] Remove suffix in autocomplete selector --- tests/Behat/Page/Admin/CreateBundledProductPage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Behat/Page/Admin/CreateBundledProductPage.php b/tests/Behat/Page/Admin/CreateBundledProductPage.php index 00a03293..5d83e714 100644 --- a/tests/Behat/Page/Admin/CreateBundledProductPage.php +++ b/tests/Behat/Page/Admin/CreateBundledProductPage.php @@ -112,7 +112,7 @@ private function clickTabIfItsNotActive(string $tabName): void private function getLastProductAutocomplete(): NodeElement { - $items = $this->getDocument()->findAll('css', '#add_product_to_bundle_autocomplete_xyz'); + $items = $this->getDocument()->findAll('css', '#add_product_to_bundle_autocomplete'); Assert::notEmpty($items); From f66d73d58b50d1a271984643eacd905400f83e4d Mon Sep 17 00:00:00 2001 From: token Date: Wed, 26 Jul 2023 14:03:23 +0200 Subject: [PATCH 21/22] Change node version in build --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d7c836ba..e4e3621b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: php: [8.0] symfony: [^5.4, ^6.0] sylius: [~1.11.0, ~1.12.0] - node: [14.20] + node: [14.17.x] mysql: [5.7, 8.0] exclude: From 0be02bd38b1948c717c187d9f1fe9fb3b59618da Mon Sep 17 00:00:00 2001 From: token Date: Fri, 28 Jul 2023 14:50:44 +0200 Subject: [PATCH 22/22] Clean bundles.php --- tests/Application/config/bundles.php | 9 +++------ .../config/sylius/1.11/bundles.php | 20 +------------------ .../config/sylius/1.12/bundles.php | 9 --------- 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index 2c74f6f6..18e508fd 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -1,11 +1,5 @@ ['test' => true], Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['test' => true], Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], + Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], + BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], + SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/sylius/1.11/bundles.php b/tests/Application/config/sylius/1.11/bundles.php index 9c9733b1..b8da49fb 100644 --- a/tests/Application/config/sylius/1.11/bundles.php +++ b/tests/Application/config/sylius/1.11/bundles.php @@ -1,25 +1,7 @@ ['all' => true], ]; - -if (class_exists('BabDev\PagerfantaBundle\BabDevPagerfantaBundle')) { - $bundles[BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class] = ['all' => true]; -} -if (class_exists('SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle')) { - $bundles[SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class] = ['all' => true]; -} -if (class_exists('Sylius\Calendar\SyliusCalendarBundle')) { - $bundles[Sylius\Calendar\SyliusCalendarBundle::class] = ['all' => true]; -} - -return $bundles; diff --git a/tests/Application/config/sylius/1.12/bundles.php b/tests/Application/config/sylius/1.12/bundles.php index 46a29947..5f922a2d 100644 --- a/tests/Application/config/sylius/1.12/bundles.php +++ b/tests/Application/config/sylius/1.12/bundles.php @@ -1,16 +1,7 @@ ['all' => true], - Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], - BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], ];