quoteResource = $objectManager->get(QuoteResource::class); $this->quoteFactory = $objectManager->get(QuoteFactory::class); $this->quoteIdToMaskedId = $objectManager->get(QuoteIdToMaskedQuoteIdInterface::class); } /** * @magentoApiDataFixture Magento/Checkout/_files/simple_product.php * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php * @magentoApiDataFixture Magento/Checkout/_files/quote_with_virtual_product_saved.php */ public function testMergeGuestCarts() { $this->expectException(\Exception::class); $this->expectExceptionMessage('The current customer isn\'t authorized.'); $firstQuote = $this->quoteFactory->create(); $this->quoteResource->load($firstQuote, 'test_order_with_simple_product_without_address', 'reserved_order_id'); $secondQuote = $this->quoteFactory->create(); $this->quoteResource->load( $secondQuote, 'test_order_with_virtual_product_without_address', 'reserved_order_id' ); $firstMaskedId = $this->quoteIdToMaskedId->execute((int)$firstQuote->getId()); $secondMaskedId = $this->quoteIdToMaskedId->execute((int)$secondQuote->getId()); $query = $this->getCartMergeMutation($firstMaskedId, $secondMaskedId); $this->graphQlMutation($query); } /** * Create the mergeCart mutation * * @param string $guestQuoteMaskedId * @param string $customerQuoteMaskedId * @return string */ private function getCartMergeMutation(string $guestQuoteMaskedId, string $customerQuoteMaskedId): string { return <<