[Api][Admin][Order] Enable behat tests

This commit is contained in:
Wojdylak 2024-08-13 12:05:20 +02:00 committed by Grzegorz Sadowski
parent 09d9a783bc
commit 5f9bf476c3
31 changed files with 164 additions and 174 deletions

View file

@ -14,7 +14,7 @@ Feature: Cancelling orders
And the customer chose "Free" shipping method to "United States" with "Cash on Delivery" payment
And I am logged in as an administrator
@ui @api
@api @ui
Scenario: Cancelling an order
When I view the summary of the order "#00000022"
And I cancel this order
@ -24,13 +24,13 @@ Feature: Cancelling orders
And it should have payment state "Cancelled"
And there should be only 1 payment
@ui @api
@api @ui
Scenario: Cannot cancel an order, which is already cancelled
Given the customer cancelled this order
When I view the summary of the order "#00000022"
Then I should not be able to cancel this order
@ui @api
@api @ui
Scenario: Checking order payment state of a cancelled order
Given this order was cancelled
When I browse orders

View file

@ -17,7 +17,7 @@ Feature: Cancelling order with promotion applied
And the customer chose "Free" shipping method with "Cash on Delivery" payment
And I am logged in as an administrator
@ui @api
@api @ui
Scenario: Cancelling order when the applied promotion is no longer valid
Given the promotion was disabled for the channel "Web"
When I view the summary of the order "#00000001"

View file

@ -15,35 +15,35 @@ Feature: Order gets fulfilled after it's been paid and shipped
And I am logged in as an administrator
And I am viewing the summary of this order
@ui @api
@api @ui
Scenario: An order can be fulfilled
When I mark this order as paid
And I ship this order
Then its state should be "Fulfilled"
@ui @api
@api @ui
Scenario: An order which has been shipped gets fulfilled after paying
Given the order "#00000123" is already shipped
When I mark this order as paid
Then its state should be "Fulfilled"
@ui @api
@api @ui
Scenario: An order which has been paid for gets fulfilled after shipping it
Given the order "#00000123" is already paid
When I ship this order
Then its state should be "Fulfilled"
@ui @api
@api @ui
Scenario: A paid, but not shipped order is not fulfilled
When I mark this order as paid
Then its state should be "New"
@ui @api
@api @ui
Scenario: A shipped, but not paid order is not fulfilled
When I ship this order
Then its state should be "New"
@ui @api
@api @ui
Scenario: Fulfilled orders cannot be cancelled
When I mark this order as paid
And I ship this order

View file

@ -15,12 +15,12 @@ Feature: Payments are in the state "new" after checkout
And the customer chose "Free" shipping method with "Cash on Delivery" payment
And I am logged in as an administrator
@ui
@api @ui
Scenario: Checking payment state of a placed order
When I view the summary of the order "#00000666"
Then it should have payment state "New"
@ui
@api @ui
Scenario: Checking order payment state of a placed order
When I browse orders
Then the order "#00000666" should have order payment state "Awaiting payment"

View file

@ -17,14 +17,14 @@ Feature: Resending a shipment confirmation email for a chosen order
And this order has already been shipped
And I am logged in as an administrator
@ui @email @api
@api @ui @email
Scenario: Resending a shipment confirmation email for a given order
When I view the summary of the order "#00000666"
And I resend the shipment confirmation email
Then I should be notified that the shipment confirmation email has been successfully resent to the customer
And an email with the shipment's confirmation of the order "#00000666" should be sent to "lucy@teamlucifer.com"
@ui @email @api
@api @ui @email
Scenario: Resending a shipment confirmation email after shipping an order in different locale than the default one
Given the order "#00000666" has been placed in "Polish (Poland)" locale
When I view the summary of the order "#00000666"
@ -32,7 +32,7 @@ Feature: Resending a shipment confirmation email for a chosen order
Then I should be notified that the shipment confirmation email has been successfully resent to the customer
And an email with the shipment's confirmation of the order "#00000666" should be sent to "lucy@teamlucifer.com" in "Polish (Poland)" locale
@ui @email @api
@api @ui @email
Scenario: Not being able to resend a confirmation email for a given shipment with wrong state
Given this customer placed another order "#00000023"
And the customer bought a single "Angel T-Shirt"

View file

@ -16,14 +16,14 @@ Feature: Sending a confirmation email after shipping an order
And the customer chose "Free" shipping method with "Cash on Delivery" payment
And I am logged in as an administrator
@ui @email
@api @ui @email
Scenario: Sending a confirmation email after shipping an order
When I view the summary of the order "#00000666"
And specify its tracking code as "#00044"
And I ship this order
Then an email with shipment's details of this order should be sent to "lucy@teamlucifer.com"
@ui @email
@api @ui @email
Scenario: Sending a confirmation email after shipping an order in different locale than the default one
Given the order "#00000666" has been placed in "Polish (Poland)" locale
When I view the summary of the order "#00000666"

View file

@ -24,7 +24,7 @@ Feature: Modifying a customer billing address after an order has been placed
Then I should be notified that it has been successfully edited
And this order should have "Lucifer Morningstar", "Seaside Fwy", "90802", "Los Angeles", "United States" as its billing address
@ui @mink:chromedriver @no-api
@no-api @ui @mink:chromedriver
Scenario: Being able to choose only provinces of the selected country
Given the store also has country "Poland"
And this country has the "Malopolska" province with "ML" code

View file

@ -25,7 +25,7 @@ Feature: Modifying a customer shipping address after an order has been placed
Then I should be notified that it has been successfully edited
And this order should be shipped to "Lucifer Morningstar", "Seaside Fwy", "90802", "Los Angeles", "United States"
@ui @mink:chromedriver @no-api
@no-api @ui @mink:chromedriver
Scenario: Being able to choose only provinces of the selected country
Given the store also has country "Poland"
And this country has the "Malopolska" province with "ML" code

View file

@ -10,7 +10,7 @@ Feature: Being unable to see details of a cart
And the customer added "PHP T-Shirt" product to the cart
And I am logged in as an administrator
@ui @api
@api @ui
Scenario: Being unable to see the details of a cart
When I try to view the summary of the customer's latest cart
Then I should be informed that the order does not exist

View file

@ -26,7 +26,7 @@ Feature: Seeing payment state as paid after checkout steps if order total is zer
When I view the summary of the order "#00000666"
Then I should be informed that there are no payments
@ui @no-api
@no-api @ui
Scenario: Seeing payment state as paid on order's summary
When I view the summary of the order "#00000666"
Then I should be informed that there are no payments

View file

@ -14,16 +14,16 @@ Feature: Filtering orders by a customer
And this customer has also placed an order "#00000003" at "2016-12-06 10:00"
And I am logged in as an administrator
@api-todo @ui @mink:chromedriver
@api @ui @mink:chromedriver
Scenario: Filtering orders by a customer
When I browse orders
And I filter by customer "Lirael Abhorsen"
And I filter by customer "lirael@abhorsen.com"
Then I should see a single order in the list
And I should see an order with "#00000002" number
@api-todo @ui @mink:chromedriver
@api @ui @mink:chromedriver
Scenario: Filtering orders by another customer
When I browse orders
And I filter by customer "Ghastly"
And I filter by customer "ghastly@suits.com"
Then I should see a single order in the list
And I should see an order with "#00000003" number

View file

@ -16,14 +16,14 @@ Feature: Resending an order confirmation email for a chosen order
And the customer chose "Free" shipping method with "Cash on Delivery" payment
And I am logged in as an administrator
@ui @email @api
@api @ui @email
Scenario: Resending a confirmation email for an order
When I view the summary of the order "#00000666"
And I resend the order confirmation email
Then I should be notified that the order confirmation email has been successfully resent to the customer
And an email with the confirmation of the order "#00000666" should be sent to "lucy@teamlucifer.com"
@ui @email @api
@api @ui @email
Scenario: Resending a confirmation email for an order in different locale than the default one
Given the order "#00000666" has been placed in "Polish (Poland)" locale
When I view the summary of the order "#00000666"
@ -31,7 +31,7 @@ Feature: Resending an order confirmation email for a chosen order
Then I should be notified that the order confirmation email has been successfully resent to the customer
And an email with the confirmation of the order "#00000666" should be sent to "lucy@teamlucifer.com" in "Polish (Poland)" locale
@ui @email @api
@api @ui @email
Scenario: Not being able to resend a confirmation email for an order with wrong state
When I view the summary of the order "#00000666"
And I cancel this order

View file

@ -19,7 +19,6 @@ use Sylius\Behat\Client\ApiClientInterface;
use Sylius\Behat\Client\ResponseCheckerInterface;
use Sylius\Behat\Context\Api\Resources;
use Sylius\Behat\Context\Api\Subresources;
use Sylius\Behat\Service\Converter\SectionAwareIriConverterInterface;
use Sylius\Behat\Service\SecurityServiceInterface;
use Sylius\Behat\Service\SharedSecurityServiceInterface;
use Sylius\Behat\Service\SharedStorageInterface;
@ -40,7 +39,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Intl\Countries;
use Webmozart\Assert\Assert;
final class ManagingOrdersContext implements Context
final readonly class ManagingOrdersContext implements Context
{
public function __construct(
private ApiClientInterface $client,
@ -49,7 +48,6 @@ final class ManagingOrdersContext implements Context
private SecurityServiceInterface $adminSecurityService,
private SharedStorageInterface $sharedStorage,
private SharedSecurityServiceInterface $sharedSecurityService,
private SectionAwareIriConverterInterface $sectionAwareIriConverter,
) {
}
@ -61,7 +59,7 @@ final class ManagingOrdersContext implements Context
public function iSeeTheOrder(OrderInterface $order): void
{
$response = $this->client->show(Resources::ORDERS, $order->getTokenValue());
Assert::same($this->responseChecker->getValue($response, '@id'), $this->sectionAwareIriConverter->getIriFromResourceInSection($order, 'admin'));
Assert::same($this->responseChecker->getValue($response, '@id'), $this->iriConverter->getIriFromResourceInSection($order, 'admin'));
$this->sharedStorage->set('order', $order);
}
@ -147,7 +145,7 @@ final class ManagingOrdersContext implements Context
$this->client->customItemAction(
Resources::ORDERS,
$this->sharedStorage->get('order')->getTokenValue(),
HttpRequest::METHOD_POST,
HttpRequest::METHOD_PATCH,
'resend-confirmation-email',
);
}
@ -165,6 +163,15 @@ final class ManagingOrdersContext implements Context
$this->client->filter();
}
/**
* @When I filter by customer :customer
*/
public function iFilterByCustomer(CustomerInterface $customer): void
{
$this->client->addFilter('customer.id', $customer->getId());
$this->client->filter();
}
/**
* @When I resend the shipment confirmation email
*/
@ -427,7 +434,11 @@ final class ManagingOrdersContext implements Context
public function theOrderShouldHavePaymentState(OrderInterface $order, string $paymentState): void
{
Assert::true(
$this->responseChecker->hasValue($this->client->show(Resources::ORDERS, $order->getTokenValue()), 'paymentState', strtolower($paymentState)),
$this->responseChecker->hasValue(
$this->client->show(Resources::ORDERS, $order->getTokenValue()),
'paymentState',
str_replace(' ', '_', strtolower($paymentState)),
),
sprintf('Order %s does not have %s payment state', $order->getTokenValue(), $paymentState),
);
}
@ -753,7 +764,7 @@ final class ManagingOrdersContext implements Context
*/
public function itShouldHaveNoShippingAddressSet(): void
{
Assert::false($this->responseChecker->hasKey($this->client->getLastResponse(), 'shippingAddress'));
Assert::null($this->responseChecker->getValue($this->client->getLastResponse(), 'shippingAddress'));
}
/**
@ -1168,7 +1179,7 @@ final class ManagingOrdersContext implements Context
$this->client->customItemAction(
Resources::ORDERS,
$this->sharedStorage->get('order')->getTokenValue(),
HttpRequest::METHOD_POST,
HttpRequest::METHOD_PATCH,
'resend-confirmation-email',
);

View file

@ -35,9 +35,9 @@ final class ManagingPlacedOrderAddressesContext implements Context
];
public function __construct(
private ApiClientInterface $client,
private ResponseCheckerInterface $responseChecker,
private SharedStorageInterface $sharedStorage,
private readonly ApiClientInterface $client,
private readonly ResponseCheckerInterface $responseChecker,
private readonly SharedStorageInterface $sharedStorage,
) {
}

View file

@ -18,10 +18,12 @@ use Sylius\Behat\Client\ApiClientInterface;
use Sylius\Behat\Client\ResponseCheckerInterface;
use Webmozart\Assert\Assert;
final class ResponseContext implements Context
final readonly class ResponseContext implements Context
{
public function __construct(private ResponseCheckerInterface $responseChecker, private ApiClientInterface $client)
{
public function __construct(
private ResponseCheckerInterface $responseChecker,
private ApiClientInterface $client,
) {
}
/**

View file

@ -22,7 +22,7 @@ use Sylius\Component\Core\Model\ProductVariantInterface;
use Symfony\Component\HttpFoundation\Request as HTTPRequest;
use Webmozart\Assert\Assert;
final class CheckoutCompleteContext implements Context
final readonly class CheckoutCompleteContext implements Context
{
public function __construct(
private RequestFactoryInterface $requestFactory,

View file

@ -13,12 +13,12 @@ declare(strict_types=1);
namespace Sylius\Behat\Context\Api\Shop;
use ApiPlatform\Api\IriConverterInterface;
use Behat\Behat\Context\Context;
use Sylius\Behat\Client\ApiClientInterface;
use Sylius\Behat\Client\RequestFactoryInterface;
use Sylius\Behat\Client\ResponseCheckerInterface;
use Sylius\Behat\Context\Api\Resources;
use Sylius\Behat\Service\Converter\IriConverterInterface;
use Sylius\Behat\Service\SharedStorageInterface;
use Sylius\Component\Addressing\Model\CountryInterface;
use Sylius\Component\Addressing\Model\ProvinceInterface;
@ -52,17 +52,17 @@ final class CheckoutContext implements Context
private array $content = [];
public function __construct(
private ApiClientInterface $client,
private ResponseCheckerInterface $responseChecker,
private RepositoryInterface $shippingMethodRepository,
private OrderRepositoryInterface $orderRepository,
private RepositoryInterface $paymentMethodRepository,
private ProductVariantResolverInterface $productVariantResolver,
private IriConverterInterface $iriConverter,
private SharedStorageInterface $sharedStorage,
private RequestFactoryInterface $requestFactory,
private string $paymentMethodClass,
private string $shippingMethodClass,
private readonly ApiClientInterface $client,
private readonly ResponseCheckerInterface $responseChecker,
private readonly RepositoryInterface $shippingMethodRepository,
private readonly OrderRepositoryInterface $orderRepository,
private readonly RepositoryInterface $paymentMethodRepository,
private readonly ProductVariantResolverInterface $productVariantResolver,
private readonly IriConverterInterface $iriConverter,
private readonly SharedStorageInterface $sharedStorage,
private readonly RequestFactoryInterface $requestFactory,
private readonly string $paymentMethodClass,
private readonly string $shippingMethodClass,
) {
}
@ -398,7 +398,8 @@ final class CheckoutContext implements Context
HTTPRequest::METHOD_PATCH,
sprintf('shipments/%s', $this->getCart()['shipments'][0]['id']),
);
$request->setContent(['shippingMethod' => $this->iriConverter->getItemIriFromResourceClass($this->shippingMethodClass, ['code' => $shippingMethodCode])]);
$request->setContent(['shippingMethod' => $this->iriConverter->getIriFromResource($this->shippingMethodClass)]);
// $request->setContent(['shippingMethod' => $this->iriConverter->getItemIriFromResourceClass($this->shippingMethodClass, ['code' => $shippingMethodCode])]);
$this->client->executeCustomRequest($request);
}
@ -415,7 +416,8 @@ final class CheckoutContext implements Context
HTTPRequest::METHOD_PATCH,
sprintf('payments/%s', $this->getCart()['payments'][0]['id']),
);
$request->setContent(['paymentMethod' => $this->iriConverter->getItemIriFromResourceClass($this->paymentMethodClass, ['code' => $paymentMethodCode])]);
$request->setContent(['paymentMethod' => $this->iriConverter->getIriFromResource($this->paymentMethodClass)]);
// $request->setContent(['paymentMethod' => $this->iriConverter->getItemIriFromResourceClass($this->paymentMethodClass, ['code' => $paymentMethodCode])]);
$this->client->executeCustomRequest($request);
}
@ -1163,9 +1165,14 @@ final class CheckoutContext implements Context
/** @var ProductVariantInterface $variant */
$variant = $product->getVariants()->first();
$request->setContent([
'productVariant' => $this->iriConverter->getItemIriFromResourceClass($variant::class, ['code' => $code]),
'productVariant' => $this->iriConverter->getIriFromResource($variant::class),
'quantity' => 1,
]);
//
// $request->setContent([
// 'productVariant' => $this->iriConverter->getItemIriFromResourceClass($variant::class, ['code' => $code]),
// 'quantity' => 1,
// ]);
$this->sharedStorage->set('response', $this->client->executeCustomRequest($request));
}

View file

@ -34,7 +34,7 @@ use Symfony\Component\HttpFoundation\Request as HttpRequest;
use Symfony\Component\HttpFoundation\Response;
use Webmozart\Assert\Assert;
final class OrderContext implements Context
final readonly class OrderContext implements Context
{
public function __construct(
private ApiClientInterface $shopClient,

View file

@ -31,7 +31,7 @@ use Sylius\Component\Product\Resolver\ProductVariantResolverInterface;
use Sylius\Component\Resource\Generator\RandomnessGeneratorInterface;
use Symfony\Component\Messenger\MessageBusInterface;
final class CartContext implements Context
final readonly class CartContext implements Context
{
/**
* @param OrderRepositoryInterface<OrderInterface> $orderRepository
@ -83,10 +83,10 @@ final class CartContext implements Context
$tokenValue = $this->pickupCart();
}
$this->commandBus->dispatch(AddItemToCart::createFromData(
$tokenValue,
$productVariant->getCode(),
1,
$this->commandBus->dispatch(new AddItemToCart(
productVariantCode: $productVariant->getCode(),
quantity: 1,
orderTokenValue: $tokenValue,
));
$this->sharedStorage->set('product', $productVariant->getProduct());
@ -105,16 +105,16 @@ final class CartContext implements Context
$tokenValue = $this->pickupCart();
}
$this->commandBus->dispatch(AddItemToCart::createFromData(
$tokenValue,
$this
$this->commandBus->dispatch(new AddItemToCart(
productVariantCode: $this
->getProductVariantWithProductOptionAndProductOptionValue(
$product,
$productOption,
$productOptionValue,
)
->getCode(),
1,
quantity: 1,
orderTokenValue: $tokenValue,
));
}
@ -127,8 +127,10 @@ final class CartContext implements Context
$tokenValue = $this->pickupCart();
}
$updateCart = UpdateCart::createWithCouponData($couponCode);
$updateCart->setOrderTokenValue($tokenValue);
$updateCart = new UpdateCart(
couponCode: $couponCode,
orderTokenValue: $tokenValue,
);
$this->commandBus->dispatch($updateCart);
}
@ -141,19 +143,21 @@ final class CartContext implements Context
$channel = $this->sharedStorage->get('channel');
$channelCode = $channel->getCode();
$commandPickupCart = new PickupCart($tokenValue);
$commandPickupCart->setChannelCode($channelCode);
if ($this->sharedStorage->has('token') && $this->sharedStorage->has('user')) {
$user = $this->sharedStorage->get('user');
if ($user instanceof ShopUserInterface) {
/** @var CustomerInterface $customer */
$customer = $user->getCustomer();
$commandPickupCart->setEmail($customer->getEmail());
$email = $user->getCustomer()->getEmail();
}
}
$commandPickupCart = new PickupCart(
tokenValue: $tokenValue,
channelCode: $channelCode,
email: $email ?? null,
);
$this->commandBus->dispatch($commandPickupCart);
$this->sharedStorage->set('cart_token', $tokenValue);
@ -187,10 +191,10 @@ final class CartContext implements Context
$tokenValue = $this->pickupCart();
}
$this->commandBus->dispatch(AddItemToCart::createFromData(
$tokenValue,
$this->productVariantResolver->getVariant($product)->getCode(),
$quantity,
$this->commandBus->dispatch(new AddItemToCart(
productVariantCode: $this->productVariantResolver->getVariant($product)->getCode(),
quantity: $quantity,
orderTokenValue: $tokenValue,
));
$this->sharedStorage->set('product', $product);

View file

@ -201,11 +201,11 @@ final readonly class ManagingOrdersContext implements Context
}
/**
* @When I filter by customer :customerName
* @When I filter by customer :customer
*/
public function iFilterByCustomer(string $customerName): void
public function iFilterByCustomer(CustomerInterface $customer): void
{
$this->indexPage->specifyFilterCustomer($customerName);
$this->indexPage->specifyFilterCustomer($customer->getFullName());
$this->iFilter();
}

View file

@ -210,24 +210,14 @@
<argument>%sylius.security.new_api_route%</argument>
</service>
<!-- <service id="sylius.behat.context.api.admin.managing_orders" class="Sylius\Behat\Context\Api\Admin\ManagingOrdersContext">-->
<!-- <argument type="service" id="sylius.behat.api_platform_client.admin" />-->
<!-- <argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />-->
<!-- <argument type="service" id="api_platform.iri_converter" />-->
<!-- <argument type="service" id="sylius.behat.api_security" />-->
<!-- <argument type="service" id="sylius.behat.shared_storage" />-->
<!-- <argument type="service" id="sylius.behat.api.shared_security" />-->
<!-- <argument type="service" id="sylius.behat.section_iri_converter" />-->
<!-- </service>-->
<!-- <service id="sylius.behat.context.api.admin.managing_orders" class="Sylius\Behat\Context\Api\Admin\ManagingOrdersContext">-->
<!-- <argument type="service" id="sylius.behat.api_platform_client.admin" />-->
<!-- <argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />-->
<!-- <argument type="service" id="api_platform.iri_converter" />-->
<!-- <argument type="service" id="sylius.behat.api_security" />-->
<!-- <argument type="service" id="sylius.behat.shared_storage" />-->
<!-- <argument type="service" id="sylius.behat.api.shared_security" />-->
<!-- </service>-->
<service id="sylius.behat.context.api.admin.managing_orders" class="Sylius\Behat\Context\Api\Admin\ManagingOrdersContext">
<argument type="service" id="sylius.behat.api_platform_client.admin" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="api_platform.iri_converter" />
<argument type="service" id="sylius.behat.api_security" />
<argument type="service" id="sylius.behat.shared_storage" />
<argument type="service" id="sylius.behat.api.shared_security" />
</service>
<service id="sylius.behat.context.api.admin.managing_payment_methods" class="Sylius\Behat\Context\Api\Admin\ManagingPaymentMethodsContext">
<argument type="service" id="sylius.behat.api_platform_client.admin" />
@ -297,11 +287,11 @@
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
</service>
<!-- <service id="sylius.behat.context.api.admin.managing_placed_order_addresses" class="Sylius\Behat\Context\Api\Admin\ManagingPlacedOrderAddressesContext">-->
<!-- <argument type="service" id="sylius.behat.api_platform_client.admin" />-->
<!-- <argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />-->
<!-- <argument type="service" id="sylius.behat.shared_storage" />-->
<!-- </service>-->
<service id="sylius.behat.context.api.admin.managing_placed_order_addresses" class="Sylius\Behat\Context\Api\Admin\ManagingPlacedOrderAddressesContext">
<argument type="service" id="sylius.behat.api_platform_client.admin" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="sylius.behat.shared_storage" />
</service>
<service id="sylius.behat.context.api.admin.managing_promotion_coupons" class="Sylius\Behat\Context\Api\Admin\ManagingPromotionCouponsContext">
<argument type="service" id="sylius.behat.api_platform_client.admin" />

View file

@ -28,9 +28,9 @@
<argument type="service" id="sylius.behat.api_platform_client.admin" />
</service>
<!-- <service id="sylius.behat.context.api.shop.response" class="Sylius\Behat\Context\Api\Common\ResponseContext">-->
<!-- <argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />-->
<!-- <argument type="service" id="sylius.behat.api_platform_client.shop" />-->
<!-- </service>-->
<service id="sylius.behat.context.api.shop.response" class="Sylius\Behat\Context\Api\Common\ResponseContext">
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="sylius.behat.api_platform_client.shop" />
</service>
</services>
</container>

View file

@ -71,19 +71,19 @@
<!-- <argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />-->
<!-- </service>-->
<!-- <service id="sylius.behat.context.api.shop.checkout" class="Sylius\Behat\Context\Api\Shop\CheckoutContext">-->
<!-- <argument type="service" id="sylius.behat.api_platform_client.shop" />-->
<!-- <argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />-->
<!-- <argument type="service" id="sylius.repository.shipping_method" />-->
<!-- <argument type="service" id="sylius.repository.order" />-->
<!-- <argument type="service" id="sylius.repository.payment_method" />-->
<!-- <argument type="service" id="Sylius\Component\Product\Resolver\ProductVariantResolverInterface" />-->
<!-- <argument type="service" id="api_platform.iri_converter" />-->
<!-- <argument type="service" id="sylius.behat.shared_storage" />-->
<!-- <argument type="service" id="sylius.behat.request_factory" />-->
<!-- <argument>%sylius.model.payment_method.class%</argument>-->
<!-- <argument>%sylius.model.shipping_method.class%</argument>-->
<!-- </service>-->
<service id="sylius.behat.context.api.shop.checkout" class="Sylius\Behat\Context\Api\Shop\CheckoutContext">
<argument type="service" id="sylius.behat.api_platform_client.shop" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="sylius.repository.shipping_method" />
<argument type="service" id="sylius.repository.order" />
<argument type="service" id="sylius.repository.payment_method" />
<argument type="service" id="Sylius\Component\Product\Resolver\ProductVariantResolverInterface" />
<argument type="service" id="api_platform.iri_converter" />
<argument type="service" id="sylius.behat.shared_storage" />
<argument type="service" id="sylius.behat.request_factory" />
<argument>%sylius.model.payment_method.class%</argument>
<argument>%sylius.model.shipping_method.class%</argument>
</service>
<service id="sylius.behat.context.api.shop.homepage" class="Sylius\Behat\Context\Api\Shop\HomepageContext">
<argument type="service" id="sylius.behat.api_platform_client.shop" />
@ -143,16 +143,16 @@
<argument>%sylius.security.new_api_route%</argument>
</service>
<!-- <service id="sylius.behat.context.api.shop.order" class="Sylius\Behat\Context\Api\Shop\OrderContext">-->
<!-- <argument type="service" id="sylius.behat.api_platform_client.shop" />-->
<!-- <argument type="service" id="sylius.behat.api_platform_client.admin" />-->
<!-- <argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />-->
<!-- <argument type="service" id="sylius.behat.shared_storage" />-->
<!-- <argument type="service" id="api_platform.iri_converter" />-->
<!-- <argument type="service" id="sylius.behat.api_security" />-->
<!-- <argument type="service" id="sylius.behat.request_factory" />-->
<!-- <argument>%sylius.security.new_api_route%</argument>-->
<!-- </service>-->
<service id="sylius.behat.context.api.shop.order" class="Sylius\Behat\Context\Api\Shop\OrderContext">
<argument type="service" id="sylius.behat.api_platform_client.shop" />
<argument type="service" id="sylius.behat.api_platform_client.admin" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="sylius.behat.shared_storage" />
<argument type="service" id="api_platform.iri_converter" />
<argument type="service" id="sylius.behat.api_security" />
<argument type="service" id="sylius.behat.request_factory" />
<argument>%sylius.security.new_api_route%</argument>
</service>
<!-- <service id="sylius.behat.context.api.shop.order_item" class="Sylius\Behat\Context\Api\Shop\OrderItemContext">-->
<!-- <argument type="service" id="sylius.behat.api_platform_client.shop" />-->
@ -184,11 +184,11 @@
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
</service>
<!-- <service id="sylius.behat.context.api.shop.checkout.complete" class="Sylius\Behat\Context\Api\Shop\Checkout\CheckoutCompleteContext">-->
<!-- <argument type="service" id="sylius.behat.request_factory" />-->
<!-- <argument type="service" id="sylius.behat.shared_storage" />-->
<!-- <argument type="service" id="sylius.behat.api_platform_client.shop" />-->
<!-- </service>-->
<service id="sylius.behat.context.api.shop.checkout.complete" class="Sylius\Behat\Context\Api\Shop\Checkout\CheckoutCompleteContext">
<argument type="service" id="sylius.behat.request_factory" />
<argument type="service" id="sylius.behat.shared_storage" />
<argument type="service" id="sylius.behat.api_platform_client.shop" />
</service>
<service id="sylius.behat.context.api.shop.taxon" class="Sylius\Behat\Context\Api\Shop\TaxonContext">
<argument type="service" id="sylius.behat.api_platform_client.shop" />

View file

@ -16,8 +16,8 @@ imports:
# - api/cart/shopping_cart.yml
- api/channel/channels.yml
- api/channel/managing_channels.yml
# - api/checkout/checkout.yml
# - api/checkout/paying_for_order.yml
- api/checkout/checkout.yml
- api/checkout/paying_for_order.yml
- api/contact/requesting_contact.yml
# - api/currency/currencies.yml
- api/currency/managing_currencies.yml
@ -29,9 +29,9 @@ imports:
# - api/inventory/managing_inventory.yaml
- api/locale/locales.yaml
- api/locale/managing_locales.yaml
# - api/order/managing_orders.yml
# - api/order/modifying_placed_order_address.yaml
# - api/order/order_history.yaml
- api/order/managing_orders.yml
- api/order/modifying_placed_order_address.yaml
- api/order/order_history.yaml
- api/payment/managing_payment_methods.yaml
- api/payment/managing_payments.yml
- api/product/adding_product_review.yml
@ -56,13 +56,13 @@ imports:
- api/promotion/managing_promotions.yml
# - api/promotion/receiving_discount.yml
- api/promotion/removing_catalog_promotions.yml
# - api/shipping/applying_shipping_method_rules.yml TODO: Enable after making checkout resource available in API
# - api/shipping/applying_shipping_fee.yaml TODO: Enable after making checkout resource available in API
# - api/shipping/viewing_shipping_methods.yml TODO: Enable after making checkout resource available in API
- api/shipping/applying_shipping_method_rules.yml
- api/shipping/applying_shipping_fee.yaml
- api/shipping/viewing_shipping_methods.yml
- api/shipping/managing_shipments.yml
- api/shipping/managing_shipping_categories.yml
- api/shipping/managing_shipping_methods.yml
# - api/taxation/applying_taxes.yml TODO: Enable after making checkout resource available in API
- api/taxation/applying_taxes.yml
- api/taxation/managing_tax_categories.yml
- api/taxation/managing_tax_rates.yml
- api/taxon/managing_taxons.yml

View file

@ -27,7 +27,7 @@ final readonly class VisitorBasedExtension implements QueryCollectionExtensionIn
{
public function __construct(
private SectionProviderInterface $sectionProvider,
private UserContextInterface $userContext
private UserContextInterface $userContext,
) {
}

View file

@ -16,24 +16,16 @@ namespace spec\Sylius\Bundle\ApiBundle\Doctrine\ORM\QueryExtension\Shop\Order;
use ApiPlatform\Doctrine\Orm\Util\QueryNameGeneratorInterface;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\Operation;
use ApiPlatform\Metadata\Put;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\QueryBuilder;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\ApiBundle\Context\UserContextInterface;
use Sylius\Bundle\ApiBundle\SectionResolver\AdminApiSection;
use Sylius\Bundle\ApiBundle\SectionResolver\ShopApiSection;
use Sylius\Bundle\ApiBundle\Serializer\ContextKeys;
use Sylius\Bundle\CoreBundle\SectionResolver\SectionProviderInterface;
use Sylius\Component\Core\Model\AdminUserInterface;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\ShopUserInterface;
use Sylius\Component\Resource\Model\ResourceInterface;
use Sylius\Component\User\Model\UserInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
final class StateBasedExtensionSpec extends ObjectBehavior
{

View file

@ -14,25 +14,18 @@ declare(strict_types=1);
namespace spec\Sylius\Bundle\ApiBundle\Doctrine\ORM\QueryExtension\Shop\Order;
use ApiPlatform\Doctrine\Orm\Util\QueryNameGeneratorInterface;
use ApiPlatform\Metadata\Delete;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\Put;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\QueryBuilder;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\ApiBundle\Context\UserContextInterface;
use Sylius\Bundle\ApiBundle\SectionResolver\AdminApiSection;
use Sylius\Bundle\ApiBundle\SectionResolver\ShopApiSection;
use Sylius\Bundle\ApiBundle\Serializer\ContextKeys;
use Sylius\Bundle\CoreBundle\SectionResolver\SectionProviderInterface;
use Sylius\Component\Core\Model\AdminUserInterface;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\ShopUserInterface;
use Sylius\Component\Resource\Model\ResourceInterface;
use Sylius\Component\User\Model\UserInterface;
use Symfony\Component\HttpFoundation\Request;
final class VisitorBasedExtensionSpec extends ObjectBehavior
{

View file

@ -18,7 +18,6 @@ use ApiPlatform\Metadata\Get;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\QueryBuilder;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\ApiBundle\Context\UserContextInterface;
use Sylius\Bundle\ApiBundle\SectionResolver\AdminApiSection;
use Sylius\Bundle\ApiBundle\SectionResolver\ShopApiSection;

View file

@ -47,8 +47,7 @@ final class AttributeTypeValidatorSpec extends ObjectBehavior
function it_throws_exception_when_constraint_is_not_an_attribute_type(
AttributeInterface $attribute,
Constraint $constraint,
): void
{
): void {
$this
->shouldThrow(\InvalidArgumentException::class)
->during('validate', [$attribute, $constraint]);

View file

@ -20,11 +20,9 @@ use Sylius\Component\Resource\Repository\RepositoryInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
final class ResendOrderConfirmationEmailHandler implements MessageHandlerInterface
final readonly class ResendOrderConfirmationEmailHandler implements MessageHandlerInterface
{
/**
* @param RepositoryInterface<OrderInterface> $orderRepository
*/
/** @param RepositoryInterface<OrderInterface> $orderRepository */
public function __construct(
private OrderEmailManagerInterface $orderEmailManager,
private RepositoryInterface $orderRepository,

View file

@ -46,7 +46,6 @@ final class OrderItemsTest extends JsonApiTestCase
$customer = $fixtures['customer_oliver'];
$this->placeOrder('token', $customer->getEmailCanonical());
$this->requestGet(
uri: '/api/v2/shop/orders/token/items',
headers: $this->headerBuilder()->withShopUserAuthorization($customer->getEmailCanonical())->build(),
@ -74,7 +73,6 @@ final class OrderItemsTest extends JsonApiTestCase
$customer = $fixtures['customer_oliver'];
$this->placeOrder('token', $customer->getEmailCanonical());
$this->requestGet(
uri: '/api/v2/shop/orders/token/items',
headers: $this->headerBuilder()->withShopUserAuthorization('dave@doe.com')->build(),
@ -102,7 +100,6 @@ final class OrderItemsTest extends JsonApiTestCase
$customer = $fixtures['customer_oliver'];
$this->placeOrder('token', $customer->getEmailCanonical());
$this->requestGet(
uri: '/api/v2/shop/orders/token/items',
headers: $this->headerBuilder()->build(),
@ -130,7 +127,6 @@ final class OrderItemsTest extends JsonApiTestCase
$customer = $fixtures['customer_oliver'];
$this->placeOrder('token', 'guest@doe.com');
$this->requestGet(
uri: '/api/v2/shop/orders/token/items',
headers: $this->headerBuilder()->build(),
@ -158,7 +154,6 @@ final class OrderItemsTest extends JsonApiTestCase
$customer = $fixtures['customer_oliver'];
$this->placeOrder('token', 'guest@doe.com');
$this->requestGet(
uri: '/api/v2/shop/orders/token/items',
headers: $this->headerBuilder()->withShopUserAuthorization('dave@doe.com')->build(),