mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
Cover seeing_order_discount.feature scenarios
This commit is contained in:
parent
d2122e03e7
commit
4fd3594435
4 changed files with 32 additions and 2 deletions
|
|
@ -15,7 +15,7 @@ Feature: Seeing discounts of an order
|
|||
And there is a customer "lucy@teamlucifer.com" that placed an order "#00000666"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Seeing promotion discount on order while buying at least 3 items
|
||||
Given the promotion gives "$15.00" discount to every order with quantity at least 3
|
||||
And the customer bought 4 "Angel T-Shirt" products
|
||||
|
|
@ -26,7 +26,7 @@ Feature: Seeing discounts of an order
|
|||
And the order's promotion discount should be "-$15.00" from "Holiday promotion" promotion
|
||||
And the order's total should be "$141.00"
|
||||
|
||||
@ui
|
||||
@ui @api
|
||||
Scenario: Seeing promotion discount on order's items while buying a product from a promoted taxon
|
||||
Given the promotion gives "$10.00" off on every product classified as "T-Shirts"
|
||||
And the customer bought a single "Angel T-Shirt"
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use Sylius\Behat\Context\Api\Resources;
|
|||
use Sylius\Behat\Service\SecurityServiceInterface;
|
||||
use Sylius\Behat\Service\SharedSecurityServiceInterface;
|
||||
use Sylius\Behat\Service\SharedStorageInterface;
|
||||
use Sylius\Component\Core\Model\AdjustmentInterface;
|
||||
use Sylius\Component\Core\Model\AdminUserInterface;
|
||||
use Sylius\Component\Core\Model\ChannelInterface;
|
||||
use Sylius\Component\Core\Model\CustomerInterface;
|
||||
|
|
@ -420,6 +421,31 @@ final class ManagingOrdersContext implements Context
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the order's promotion discount should be :promotionAmount from :promotionName promotion
|
||||
*/
|
||||
public function theOrdersPromotionDiscountShouldBeFromPromotion(string $promotionAmount, string $promotionName): 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::ORDER_PROMOTION_ADJUSTMENT,
|
||||
'label' => $promotionName,
|
||||
'amount' => $this->getTotalAsInt($promotionAmount),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(the administrator) should see that (order placed by "[^"]+") has "([^"]+)" currency$/
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ final class Resources
|
|||
{
|
||||
public const ADDRESSES = 'addresses';
|
||||
|
||||
public const ADJUSTMENTS = 'adjustments';
|
||||
|
||||
public const ADMINISTRATORS = 'administrators';
|
||||
|
||||
public const AVATAR_IMAGES = 'avatar-images';
|
||||
|
|
|
|||
|
|
@ -19,10 +19,12 @@ default:
|
|||
- sylius.behat.context.setup.order
|
||||
- sylius.behat.context.setup.payment
|
||||
- sylius.behat.context.setup.product
|
||||
- sylius.behat.context.setup.product_taxon
|
||||
- sylius.behat.context.setup.promotion
|
||||
- sylius.behat.context.setup.shipping
|
||||
- sylius.behat.context.setup.shop_api_security
|
||||
- sylius.behat.context.setup.taxation
|
||||
- sylius.behat.context.setup.taxonomy
|
||||
- sylius.behat.context.setup.zone
|
||||
|
||||
- Sylius\Calendar\Tests\Behat\Context\Setup\CalendarContext
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue