@@ -74,7 +74,7 @@ public function testRemoveCouponFromCart()
74
74
{
75
75
$ couponCode = '2?ds5!2d ' ;
76
76
77
- /* Apply coupon to the customer quote */
77
+ /* Assign the quote to the customer */
78
78
$ this ->quoteResource ->load (
79
79
$ this ->quote ,
80
80
'test_order_with_simple_product_without_address ' ,
@@ -85,6 +85,7 @@ public function testRemoveCouponFromCart()
85
85
$ this ->quote ->setCustomerId (1 );
86
86
$ this ->quoteResource ->save ($ this ->quote );
87
87
88
+ /* Apply coupon to the customer quote */
88
89
$ queryHeaders =
$ this ->
prepareAuthorizationHeaders (
'[email protected] ' ,
'password ' );
89
90
$ query = $ this ->prepareAddCouponRequestQuery ($ maskedQuoteId , $ couponCode );
90
91
$ this ->graphQlQuery ($ query , [], '' , $ queryHeaders );
@@ -106,7 +107,7 @@ public function testRemoveCouponFromCartTwice()
106
107
{
107
108
$ couponCode = '2?ds5!2d ' ;
108
109
109
- /* Apply coupon to the customer quote */
110
+ /* Assign the quote to the customer */
110
111
$ this ->quoteResource ->load (
111
112
$ this ->quote ,
112
113
'test_order_with_simple_product_without_address ' ,
@@ -117,6 +118,7 @@ public function testRemoveCouponFromCartTwice()
117
118
$ this ->quote ->setCustomerId (1 );
118
119
$ this ->quoteResource ->save ($ this ->quote );
119
120
121
+ /* Apply coupon to the customer quote */
120
122
$ queryHeaders =
$ this ->
prepareAuthorizationHeaders (
'[email protected] ' ,
'password ' );
121
123
$ query = $ this ->prepareAddCouponRequestQuery ($ maskedQuoteId , $ couponCode );
122
124
$ this ->graphQlQuery ($ query , [], '' , $ queryHeaders );
@@ -136,6 +138,32 @@ public function testRemoveCouponFromCartTwice()
136
138
self ::assertNull ($ response ['removeCouponFromCart ' ]['cart ' ]['applied_coupon ' ]['code ' ]);
137
139
}
138
140
141
+ /**
142
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
143
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
144
+ */
145
+ public function testRemoveCouponFromCartWithNoCouponApplied ()
146
+ {
147
+ /* Assign the quote to the customer */
148
+ $ this ->quoteResource ->load (
149
+ $ this ->quote ,
150
+ 'test_order_with_simple_product_without_address ' ,
151
+ 'reserved_order_id '
152
+ );
153
+ $ maskedQuoteId = $ this ->quoteIdToMaskedId ->execute ((int )$ this ->quote ->getId ());
154
+
155
+ $ this ->quote ->setCustomerId (1 );
156
+ $ this ->quoteResource ->save ($ this ->quote );
157
+
158
+ /* Remove coupon from the quote */
159
+ $ query = $ this ->prepareRemoveCouponRequestQuery ($ maskedQuoteId );
160
+ $ queryHeaders =
$ this ->
prepareAuthorizationHeaders (
'[email protected] ' ,
'password ' );
161
+ $ response = $ this ->graphQlQuery ($ query , [], '' , $ queryHeaders );
162
+
163
+ self ::assertArrayHasKey ('removeCouponFromCart ' , $ response );
164
+ self ::assertNull ($ response ['removeCouponFromCart ' ]['cart ' ]['applied_coupon ' ]['code ' ]);
165
+ }
166
+
139
167
/**
140
168
* @magentoApiDataFixture Magento/Customer/_files/customer.php
141
169
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
0 commit comments