Skip to content

Commit 3425311

Browse files
authored
ENGCOM-6870: magento/magento2#: GraphQL. MergeCarts mutation. Add additional API-functional test cases #26833
2 parents 79ab7c8 + fb328b9 commit 3425311

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,48 @@ public function testMergeTwoCustomerCarts()
163163
$this->graphQlMutation($query, [], '', $this->getHeaderMap());
164164
}
165165

166+
/**
167+
* @magentoApiDataFixture Magento/Customer/_files/customer.php
168+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
169+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
170+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
171+
* @expectedException \Exception
172+
* @expectedExceptionMessage Required parameter "source_cart_id" is missing
173+
*/
174+
public function testMergeCartsWithEmptySourceCartId()
175+
{
176+
$customerQuote = $this->quoteFactory->create();
177+
$this->quoteResource->load($customerQuote, 'test_quote', 'reserved_order_id');
178+
179+
$customerQuoteMaskedId = $this->quoteIdToMaskedId->execute((int)$customerQuote->getId());
180+
$guestQuoteMaskedId = "";
181+
182+
$query = $this->getCartMergeMutation($guestQuoteMaskedId, $customerQuoteMaskedId);
183+
$this->graphQlMutation($query, [], '', $this->getHeaderMap());
184+
}
185+
186+
/**
187+
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_virtual_product_saved.php
188+
* @magentoApiDataFixture Magento/Customer/_files/customer.php
189+
* @expectedException \Exception
190+
* @expectedExceptionMessage Required parameter "destination_cart_id" is missing
191+
*/
192+
public function testMergeCartsWithEmptyDestinationCartId()
193+
{
194+
$guestQuote = $this->quoteFactory->create();
195+
$this->quoteResource->load(
196+
$guestQuote,
197+
'test_order_with_virtual_product_without_address',
198+
'reserved_order_id'
199+
);
200+
201+
$customerQuoteMaskedId = "";
202+
$guestQuoteMaskedId = $this->quoteIdToMaskedId->execute((int)$guestQuote->getId());
203+
204+
$query = $this->getCartMergeMutation($guestQuoteMaskedId, $customerQuoteMaskedId);
205+
$this->graphQlMutation($query, [], '', $this->getHeaderMap());
206+
}
207+
166208
/**
167209
* Add simple product to cart
168210
*

0 commit comments

Comments
 (0)