Skip to content

Commit 343e463

Browse files
committed
Fixed coupon fixture
1 parent 2f4767d commit 343e463

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function setUp()
4343

4444
/**
4545
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
46-
* @magentoApiDataFixture Magento/SalesRule/_files/cart_rule_40_percent_off.php
46+
* @magentoApiDataFixture Magento/SalesRule/_files/coupon_cart_fixed_discount.php
4747
*/
4848
public function testApplyCouponToGuestCartWithItems()
4949
{
@@ -64,7 +64,7 @@ public function testApplyCouponToGuestCartWithItems()
6464

6565
/**
6666
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
67-
* @magentoApiDataFixture Magento/SalesRule/_files/cart_rule_40_percent_off.php
67+
* @magentoApiDataFixture Magento/SalesRule/_files/coupon_cart_fixed_discount.php
6868
*/
6969
public function testApplyCouponTwice()
7070
{
@@ -88,7 +88,7 @@ public function testApplyCouponTwice()
8888

8989
/**
9090
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
91-
* @magentoApiDataFixture Magento/SalesRule/_files/cart_rule_40_percent_off.php
91+
* @magentoApiDataFixture Magento/SalesRule/_files/coupon_cart_fixed_discount.php
9292
*/
9393
public function testApplyCouponToCartWithNoItems()
9494
{
@@ -104,7 +104,7 @@ public function testApplyCouponToCartWithNoItems()
104104

105105
/**
106106
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
107-
* @magentoApiDataFixture Magento/SalesRule/_files/cart_rule_40_percent_off.php
107+
* @magentoApiDataFixture Magento/SalesRule/_files/coupon_cart_fixed_discount.php
108108
* @magentoApiDataFixture Magento/Customer/_files/customer.php
109109
*/
110110
public function testGuestCustomerAttemptToChangeCustomerCart()
@@ -127,7 +127,7 @@ public function testGuestCustomerAttemptToChangeCustomerCart()
127127

128128
/**
129129
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
130-
* @magentoApiDataFixture Magento/SalesRule/_files/cart_rule_40_percent_off.php
130+
* @magentoApiDataFixture Magento/SalesRule/_files/coupon_cart_fixed_discount.php
131131
*/
132132
public function testRemoveCoupon()
133133
{
@@ -158,7 +158,7 @@ public function testRemoveCoupon()
158158

159159
/**
160160
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
161-
* @magentoApiDataFixture Magento/SalesRule/_files/cart_rule_40_percent_off.php
161+
* @magentoApiDataFixture Magento/SalesRule/_files/coupon_cart_fixed_discount.php
162162
* @magentoApiDataFixture Magento/Customer/_files/customer.php
163163
*/
164164
public function testRemoveCouponFromCustomerCartByGuest()

dev/tests/integration/testsuite/Magento/SalesRule/_files/coupon_cart_fixed_discount.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,9 @@
4747
->setCode('CART_FIXED_DISCOUNT_15')
4848
->setType(0);
4949
$objectManager->get(CouponRepositoryInterface::class)->save($coupon);
50+
51+
/** @var Magento\Framework\Registry $registry */
52+
$registry = $objectManager->get(\Magento\Framework\Registry::class);
53+
54+
$registry->unregister('cart_rule_fixed_discount_coupon');
55+
$registry->register('cart_rule_fixed_discount_coupon', $salesRule);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
use Magento\TestFramework\Helper\Bootstrap;
9+
10+
/** @var Magento\Framework\Registry $registry */
11+
$registry = Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class);
12+
13+
/** @var Magento\SalesRule\Model\Rule $rule */
14+
$rule = $registry->registry('cart_rule_fixed_discount_coupon');
15+
if ($rule) {
16+
$rule->delete();
17+
}

0 commit comments

Comments
 (0)