Skip to content

Commit c713b67

Browse files
committed
Added test for setting shipping methods as guest for a customer cart
1 parent c3b4a80 commit c713b67

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

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

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,35 @@ public function testSetShippingMethodWithNonExistingAddress()
161161
$this->sendRequestWithToken($query);
162162
}
163163

164-
// TODO: TBD - add check for guest with attempt to set shipping method to the customer's shopping cart
164+
/**
165+
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
166+
*/
167+
public function testSetShippingMethodByGuestToCustomerCart()
168+
{
169+
$shippingCarrierCode = 'flatrate';
170+
$shippingMethodCode = 'flatrate';
171+
$this->quoteResource->load(
172+
$this->quote,
173+
'test_order_1',
174+
'reserved_order_id'
175+
);
176+
$shippingAddress = $this->quote->getShippingAddress();
177+
$shippingAddressId = $shippingAddress->getId();
178+
$maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId());
179+
180+
$query = $this->prepareMutationQuery(
181+
$maskedQuoteId,
182+
$shippingMethodCode,
183+
$shippingCarrierCode,
184+
$shippingAddressId
185+
);
186+
187+
self::expectExceptionMessage(
188+
"The current user cannot perform operations on cart \"$maskedQuoteId\""
189+
);
190+
191+
$this->graphQlQuery($query);
192+
}
165193

166194
/**
167195
* Generates query for setting the specified shipping method on cart

0 commit comments

Comments
 (0)