Skip to content

Commit be238ea

Browse files
committed
MC-19255: API functional tests to cover cart promotions
- static failure fixes
1 parent 4345be2 commit be238ea

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/CartPromotionsTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public function testCartPromotionsMultipleCartRules()
199199
* @magentoApiDataFixture Magento/GraphQl/Tax/_files/tax_calculation_price_and_cart_display_settings.php
200200
* @magentoApiDataFixture Magento/SalesRule/_files/rules_category.php
201201
*/
202-
public function testCartPromotionsSingleCartRulesWithTaxes()
202+
public function testCartPromotionsCartRulesWithTaxes()
203203
{
204204
$objectManager = Bootstrap::getObjectManager();
205205
/** @var ProductRepositoryInterface $productRepository */
@@ -303,7 +303,7 @@ public function testCartPromotionsWithCoupons()
303303
$couponCode = '2?ds5!2d';
304304
$cartId = $this->createEmptyCart();
305305
$this->addMultipleSimpleProductsToCart($cartId, $qty, $skus[0], $skus[1]);
306-
$this->applyCouponToCart($cartId, $couponCode);
306+
$this->applyCouponsToCart($cartId, $couponCode);
307307
$query = $this->getCartItemPricesQuery($cartId);
308308
$response = $this->graphQlMutation($query);
309309
$this->assertCount(2, $response['cart']['items']);
@@ -349,7 +349,6 @@ public function testCartPromotionsWhenNoDiscountIsAvailable()
349349
/** @var Product $prod2 */
350350
$prod1 = $productRepository->get('simple1');
351351
$prod2 = $productRepository->get('simple2');
352-
$productsInCart = [$prod1, $prod2];
353352
$prod2->setVisibility(Visibility::VISIBILITY_BOTH);
354353
$productRepository->save($prod2);
355354
$skus =['simple1', 'simple2'];
@@ -393,13 +392,13 @@ public function testCartPromotionsWithNoRuleLabels()
393392
* @param string $cartId
394393
* @param string $couponCode
395394
*/
396-
private function applyCouponToCart(string $cartId, string $couponCode)
395+
private function applyCouponsToCart(string $cartId, string $couponCode)
397396
{
398397
$query = <<<QUERY
399398
mutation {
400399
applyCouponToCart(input: {cart_id: "$cartId", coupon_code: "$couponCode"}) {
401400
cart {
402-
applied_coupon {
401+
applied_coupons {
403402
code
404403
}
405404
}
@@ -409,7 +408,7 @@ private function applyCouponToCart(string $cartId, string $couponCode)
409408
$response = $this->graphQlMutation($query);
410409

411410
self::assertArrayHasKey('applyCouponToCart', $response);
412-
self::assertEquals($couponCode, $response['applyCouponToCart']['cart']['applied_coupon']['code']);
411+
self::assertEquals($couponCode, $response['applyCouponToCart']['cart']['applied_coupons'][0]['code']);
413412
}
414413

415414
/**

0 commit comments

Comments
 (0)