@@ -90,6 +90,50 @@ public function testMergeGuestWithCustomerCart()
90
90
$ this ->getHeaderMap ()
91
91
);
92
92
93
+ self ::assertArrayHasKey ('cart ' , $ cartResponse );
94
+ self ::assertArrayHasKey ('items ' , $ cartResponse ['cart ' ]);
95
+ self ::assertCount (2 , $ cartResponse ['cart ' ]['items ' ]);
96
+ $ item1 = $ cartResponse ['cart ' ]['items ' ][0 ];
97
+ self ::assertArrayHasKey ('quantity ' , $ item1 );
98
+ self ::assertEquals (2 , $ item1 ['quantity ' ]);
99
+ $ item2 = $ cartResponse ['cart ' ]['items ' ][1 ];
100
+ self ::assertArrayHasKey ('quantity ' , $ item2 );
101
+ self ::assertEquals (1 , $ item2 ['quantity ' ]);
102
+ }
103
+
104
+ /**
105
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_virtual_product_saved.php
106
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
107
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
108
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
109
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
110
+ * @expectedException \Exception
111
+ * @expectedExceptionMessage Current user does not have an active cart.
112
+ */
113
+ public function testGuestCartExpiryAfterMerge ()
114
+ {
115
+ $ customerQuote = $ this ->quoteFactory ->create ();
116
+ $ this ->quoteResource ->load ($ customerQuote , 'test_quote ' , 'reserved_order_id ' );
117
+
118
+ $ guestQuote = $ this ->quoteFactory ->create ();
119
+ $ this ->quoteResource ->load (
120
+ $ guestQuote ,
121
+ 'test_order_with_virtual_product_without_address ' ,
122
+ 'reserved_order_id '
123
+ );
124
+
125
+ $ customerQuoteMaskedId = $ this ->quoteIdToMaskedId ->execute ((int )$ customerQuote ->getId ());
126
+ $ guestQuoteMaskedId = $ this ->quoteIdToMaskedId ->execute ((int )$ guestQuote ->getId ());
127
+
128
+ $ query = $ this ->getCartMergeMutation ($ guestQuoteMaskedId , $ customerQuoteMaskedId );
129
+ $ this ->graphQlMutation ($ query , [], '' , $ this ->getHeaderMap ());
130
+ $ cartResponse = $ this ->graphQlMutation (
131
+ $ this ->getCartQuery ($ guestQuoteMaskedId ),
132
+ [],
133
+ '' ,
134
+ $ this ->getHeaderMap ()
135
+ );
136
+
93
137
self ::assertArrayHasKey ('cart ' , $ cartResponse );
94
138
self ::assertArrayHasKey ('items ' , $ cartResponse ['cart ' ]);
95
139
self ::assertCount (2 , $ cartResponse ['cart ' ]['items ' ]);
0 commit comments