Cover seeing_order_aggregated_taxes.feature scenarios

This commit is contained in:
Jacob Tobiasz 2023-11-27 18:36:30 +01:00 committed by Wojdylak
parent 83ec73fb52
commit 4bc7507e91
2 changed files with 27 additions and 2 deletions

View file

@ -20,7 +20,7 @@ Feature: Seeing aggregated taxes of an order
And there is a customer "charles.the.great@medieval.com" that placed an order "#00000001"
And I am logged in as an administrator
@ui
@ui @api
Scenario: Seeing aggregated taxes of products and shipping
Given the customer bought a single "Composite bow"
And the customer chose "DHL" shipping method to "United States" with "Offline" payment
@ -31,7 +31,7 @@ Feature: Seeing aggregated taxes of an order
And the order's tax total should be "$25.30"
And the order's total should be "$135.30"
@ui
@ui @api
Scenario: Seeing aggregated taxes of multiple products from different tax rates and shipping
Given the customer bought a single "Composite bow"
And the customer bought a "Claymore" and a "Bastard sword"

View file

@ -495,6 +495,31 @@ final class ManagingOrdersContext implements Context
);
}
/**
* @Then there should be a shipping tax :shippingTax for :shippingMethodName method
*/
public function thereShouldBeAShippingTaxForMethod(string $shippingTax, string $shippingMethodName): void
{
/** @var OrderInterface $order */
$order = $this->sharedStorage->get('order');
$adjustments = $this->client->subResourceIndex(
Resources::ORDERS,
Resources::ADJUSTMENTS,
$order->getTokenValue(),
true,
);
$this->responseChecker->hasItemWithValues(
$adjustments,
[
'type' => AdjustmentInterface::TAX_ADJUSTMENT,
'label' => $shippingMethodName,
'amount' => $this->getTotalAsInt($shippingTax),
],
);
}
/**
* @Then /^(the administrator) should see that (order placed by "[^"]+") has "([^"]+)" currency$/
*/