Skip to content

Commit

Permalink
[WIP]OP-289: Bump min required patches
Browse files Browse the repository at this point in the history
  • Loading branch information
hmfilar committed Sep 16, 2024
1 parent a5e8a36 commit 0a3130e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
ARG PHP_VERSION=8.1
ARG PHP_VERSION=8.2
ENV LC_ALL=C.UTF-8

# Install basic tools
Expand Down
12 changes: 6 additions & 6 deletions features/having_bundled_product_in_store.feature
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ Feature: Having a product in store which is a bundle of other products
When I pick up my cart
And I add bundle "Jim Beam&Coke" with quantity 5 to my cart and overwrite "JIM_BEAM" with "JIM_BEAM_1L"
Then I should have bundle "Jim Beam&Coke" with quantity 5 in my cart
And I should have product variant "Jim Beam 1L" in bundled items
And I should not have product variant "Jim Beam" in bundled items
And I should have product variant "JIM_BEAM_1L" in bundled items
And I should not have product variant "JIM_BEAM" in bundled items
And I should have product "Coca-Cola" in bundled items

@api
Scenario: Adding unpacked product bundles to cart and overwriting variants with invalid variant with API
When I pick up my cart
And I add bundle "Jim Beam&Coke" with quantity 5 to my cart and overwrite "COCA_COLA" with "JIM_BEAM_1L"
Then I should have bundle "Jim Beam&Coke" with quantity 5 in my cart
And I should not have product variant "Jim Beam 1L" in bundled items
And I should have product variant "Jim Beam" in bundled items
And I should not have product variant "JIM_BEAM_1L" in bundled items
And I should have product variant "JIM_BEAM" in bundled items
And I should have product "Coca-Cola" in bundled items

@api
Expand All @@ -90,6 +90,6 @@ Feature: Having a product in store which is a bundle of other products
When I pick up my cart
And I add bundle "Jim Beam&Coke" with quantity 5 to my cart and overwrite "JIM_BEAM" with "JIM_BEAM_1L"
Then I should have bundle "Jim Beam&Coke" with quantity 5 in my cart
And I should not have product variant "Jim Beam 1L" in bundled items
And I should have product variant "Jim Beam" in bundled items
And I should not have product variant "JIM_BEAM_1L" in bundled items
And I should have product variant "JIM_BEAM" in bundled items
And I should have product "Coca-Cola" in bundled items
12 changes: 10 additions & 2 deletions tests/Behat/Context/Api/ProductBundleContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Sylius\Behat\Context\Api\Resources;
use Sylius\Behat\Service\SharedStorageInterface;
use Sylius\Component\Core\Model\ProductVariantInterface;
use Sylius\Component\Core\Repository\ProductVariantRepositoryInterface;
use Symfony\Component\HttpFoundation\Request as HttpRequest;
use Webmozart\Assert\Assert;

Expand All @@ -30,6 +31,7 @@ public function __construct(
private readonly ApiClientInterface $client,
private readonly RequestFactoryInterface $requestFactory,
private readonly ResponseCheckerInterface $responseChecker,
private readonly ProductVariantRepositoryInterface $productVariantRepository,
) {
}

Expand Down Expand Up @@ -116,8 +118,11 @@ public function iShouldHaveProductInBundledItems(ProductInterface $product): voi
/**
* @When I should have product variant :productVariant in bundled items
*/
public function iShouldHaveProductVariantInBundledItems(ProductVariantInterface $productVariant): void
public function iShouldHaveProductVariantInBundledItems(string $productVariant): void
{
$productVariant = $this->productVariantRepository->findOneBy(['code' => $productVariant]);
Assert::isInstanceOf($productVariant, ProductVariantInterface::class);

$response = $this->client->show(Resources::ORDERS, $this->sharedStorage->get('cart_token'));

$productBundleOrderItems = $this->responseChecker->getValue($response, 'items')[0]['productBundleOrderItems'];
Expand All @@ -133,8 +138,11 @@ public function iShouldHaveProductVariantInBundledItems(ProductVariantInterface
/**
* @When I should not have product variant :productVariant in bundled items
*/
public function iShouldNotHaveProductVariantInBundledItems(ProductVariantInterface $productVariant): void
public function iShouldNotHaveProductVariantInBundledItems(string $productVariant): void
{
$productVariant = $this->productVariantRepository->findOneBy(['code' => $productVariant]);
Assert::isInstanceOf($productVariant, ProductVariantInterface::class);

$response = $this->client->show(Resources::ORDERS, $this->sharedStorage->get('cart_token'));

$productBundleOrderItems = $this->responseChecker->getValue($response, 'items')[0]['productBundleOrderItems'];
Expand Down
1 change: 1 addition & 0 deletions tests/Behat/Resources/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ services:
- '@sylius.behat.api_platform_client.shop'
- '@sylius.behat.request_factory'
- '@Sylius\Behat\Client\ResponseCheckerInterface'
- '@sylius.repository.product_variant'
2 changes: 0 additions & 2 deletions tests/Behat/Resources/suites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ default:
- sylius.behat.context.transform.locale
- sylius.behat.context.transform.payment
- sylius.behat.context.transform.product
- sylius.behat.context.transform.product_variant
- sylius.behat.context.transform.promotion
- sylius.behat.context.transform.shared_storage
- sylius.behat.context.transform.shipping_method
Expand All @@ -102,7 +101,6 @@ default:

- sylius.behat.context.api.shop.cart
- sylius.behat.context.api.shop.checkout
- sylius.behat.context.api.shop.checkout.complete

- bitbag_sylius_product_bundle_plugin.behat.context.api.product_bundle
- bitbag_sylius_product_bundle_plugin.behat.context.setup.product_bundle
Expand Down

0 comments on commit 0a3130e

Please sign in to comment.