Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ea0c326

Browse files
committed
qa fixes to feature
1 parent 583e952 commit ea0c326

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/Sylius/Behat/Context/Api/Shop/PromotionContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function iShouldBeNotifiedThatCouponIsInvalid(): void
5757
{
5858
$response = $this->cartsClient->getLastResponse();
5959

60-
Assert::same($response->getStatusCode(), 500);
60+
Assert::same($response->getStatusCode(), 400);
6161
Assert::notNull($this->responseChecker->getError($response));
6262
}
6363

src/Sylius/Bundle/ApiBundle/CommandHandler/Cart/ApplyCouponToCartHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(
4444
$this->orderProcessor = $orderProcessor;
4545
}
4646

47-
public function __invoke(ApplyCouponToCart $command): void
47+
public function __invoke(ApplyCouponToCart $command): OrderInterface
4848
{
4949
/** @var OrderInterface $cart */
5050
$cart = $this->orderRepository->findCartByTokenValue($command->getOrderTokenValue());
@@ -59,5 +59,7 @@ public function __invoke(ApplyCouponToCart $command): void
5959
$cart->setPromotionCoupon($promotionCoupon);
6060

6161
$this->orderProcessor->process($cart);
62+
63+
return $cart;
6264
}
6365
}

src/Sylius/Bundle/ApiBundle/Resources/config/validation/ApplyCouponToCart.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313

1414
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/services/constraint-mapping-1.0.xsd">
1515
<class name="Sylius\Bundle\ApiBundle\Command\Cart\ApplyCouponToCart">
16-
<constraint name="Sylius\Bundle\ApiBundle\Validator\Constraints\PromotionCouponEligibility" />
16+
<constraint name="Sylius\Bundle\ApiBundle\Validator\Constraints\PromotionCouponEligibility">
17+
<option name="groups">
18+
<value>sylius</value>
19+
</option>
20+
</constraint>
1721
<property name="couponCode">
1822
<constraint name="NotNull" >
1923
<option name="message">sylius.promotion_coupon.code.not_blank</option>

0 commit comments

Comments
 (0)