@@ -81,6 +81,56 @@ public function testAddSimpleProductToCart()
81
81
self ::assertEquals ('USD ' , $ rowTotalIncludingTax ['currency ' ]);
82
82
}
83
83
84
+ /**
85
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
86
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
87
+ * @magentoApiDataFixture Magento/Store/_files/second_store.php
88
+ */
89
+ public function testAddSimpleProductWithDifferentStoreHeader ()
90
+ {
91
+ $ sku = 'simple_product ' ;
92
+ $ quantity = 2 ;
93
+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ->execute ('test_quote ' );
94
+
95
+ $ headerMap = ['Store ' => 'fixture_second_store ' ];
96
+ $ query = $ this ->getQuery ($ maskedQuoteId , $ sku , $ quantity );
97
+ $ response = $ this ->graphQlMutation ($ query , [], '' , $ headerMap );
98
+ self ::assertArrayHasKey ('cart ' , $ response ['addSimpleProductsToCart ' ]);
99
+
100
+ self ::assertArrayHasKey ('shipping_addresses ' , $ response ['addSimpleProductsToCart ' ]['cart ' ]);
101
+ self ::assertEmpty ($ response ['addSimpleProductsToCart ' ]['cart ' ]['shipping_addresses ' ]);
102
+ self ::assertEquals ($ quantity , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['quantity ' ]);
103
+ self ::assertEquals ($ sku , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['product ' ]['sku ' ]);
104
+ self ::assertArrayHasKey ('prices ' , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]);
105
+ self ::assertArrayHasKey ('id ' , $ response ['addSimpleProductsToCart ' ]['cart ' ]);
106
+ self ::assertEquals ($ maskedQuoteId , $ response ['addSimpleProductsToCart ' ]['cart ' ]['id ' ]);
107
+
108
+ self ::assertArrayHasKey ('price ' , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]);
109
+ $ price = $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]['price ' ];
110
+ self ::assertArrayHasKey ('value ' , $ price );
111
+ self ::assertEquals (10 , $ price ['value ' ]);
112
+ self ::assertArrayHasKey ('currency ' , $ price );
113
+ self ::assertEquals ('USD ' , $ price ['currency ' ]);
114
+
115
+ self ::assertArrayHasKey ('row_total ' , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]);
116
+ $ rowTotal = $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]['row_total ' ];
117
+ self ::assertArrayHasKey ('value ' , $ rowTotal );
118
+ self ::assertEquals (20 , $ rowTotal ['value ' ]);
119
+ self ::assertArrayHasKey ('currency ' , $ rowTotal );
120
+ self ::assertEquals ('USD ' , $ rowTotal ['currency ' ]);
121
+
122
+ self ::assertArrayHasKey (
123
+ 'row_total_including_tax ' ,
124
+ $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]
125
+ );
126
+ $ rowTotalIncludingTax =
127
+ $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]['row_total_including_tax ' ];
128
+ self ::assertArrayHasKey ('value ' , $ rowTotalIncludingTax );
129
+ self ::assertEquals (20 , $ rowTotalIncludingTax ['value ' ]);
130
+ self ::assertArrayHasKey ('currency ' , $ rowTotalIncludingTax );
131
+ self ::assertEquals ('USD ' , $ rowTotalIncludingTax ['currency ' ]);
132
+ }
133
+
84
134
/**
85
135
* @magentoApiDataFixture Magento/Catalog/_files/product_with_image_no_options.php
86
136
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
0 commit comments