@@ -113,6 +113,114 @@ public function testCheckIfCatalogRuleIsAppliedForTierPriceForGuest(): void
113113 $ this ->assertEquals (10 , $ priceRange ['maximum_price ' ]['discount ' ]['percent_off ' ]);
114114 }
115115
116+ /**
117+ * Test to make sure tax amount is displayed correctly for a logged-in user
118+ *
119+ * @magentoConfigFixture default_store tax/display/type 2
120+ *
121+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
122+ * @magentoApiDataFixture Magento/Customer/_files/customer_shipping_address_36104.php
123+ * @magentoApiDataFixture Magento/Tax/_files/tax_rule_postal_36104.php
124+ * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php
125+ */
126+ public function testTaxDisplayAppliesToCustomer (): void
127+ {
128+ $ productSku = 'simple ' ;
129+ $ query = $ this ->getProductSearchQuery ($ productSku );
130+ $ response = $ this ->graphQlQuery (
131+ $ query ,
132+ [],
133+ '' ,
134+ $ this ->getCustomerAuthenticationHeader ->execute ('customer@example.com ' , 'password ' )
135+ );
136+
137+ $ this ->assertNotEmpty ($ response ['products ' ]);
138+ $ priceRange = $ response ['products ' ]['items ' ][0 ]['price_range ' ];
139+ $ this ->assertEquals (10.75 , round ($ priceRange ['minimum_price ' ]['regular_price ' ]['value ' ], 2 ));
140+ $ this ->assertEquals (10.75 , round ($ priceRange ['minimum_price ' ]['final_price ' ]['value ' ], 2 ));
141+ $ this ->assertEquals (10.75 , round ($ priceRange ['maximum_price ' ]['regular_price ' ]['value ' ], 2 ));
142+ $ this ->assertEquals (10.75 , round ($ priceRange ['maximum_price ' ]['final_price ' ]['value ' ], 2 ));
143+ }
144+
145+ /**
146+ * Test to make sure tax rule is not applied in display for guest
147+ *
148+ * @magentoConfigFixture default_store tax/display/type 2
149+ *
150+ * @magentoApiDataFixture Magento/Tax/_files/tax_rule_postal_36104.php
151+ * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php
152+ */
153+ public function testTaxDisplayDoesNotApplyToGuest (): void
154+ {
155+ $ productSku = 'simple ' ;
156+ $ query = $ this ->getProductSearchQuery ($ productSku );
157+ $ response = $ this ->graphQlQuery ($ query );
158+
159+ $ this ->assertNotEmpty ($ response ['products ' ]);
160+ $ priceRange = $ response ['products ' ]['items ' ][0 ]['price_range ' ];
161+ $ this ->assertEquals (10 , $ priceRange ['minimum_price ' ]['regular_price ' ]['value ' ]);
162+ $ this ->assertEquals (10 , $ priceRange ['minimum_price ' ]['final_price ' ]['value ' ]);
163+ $ this ->assertEquals (10 , $ priceRange ['maximum_price ' ]['regular_price ' ]['value ' ]);
164+ $ this ->assertEquals (10 , $ priceRange ['maximum_price ' ]['final_price ' ]['value ' ]);
165+ }
166+
167+ /**
168+ * Test to make sure tax rule is applied for customer group
169+ *
170+ * @magentoConfigFixture default_store tax/display/type 2
171+ *
172+ * @magentoApiDataFixture Magento/Customer/_files/customer_with_group_and_address.php
173+ * @magentoApiDataFixture Magento/Tax/_files/tax_class_customer_group.php
174+ * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php
175+ */
176+ public function testTaxDisplayAppliesToCustomerGroup ()
177+ {
178+ $ productSku = 'simple ' ;
179+ $ query = $ this ->getProductSearchQuery ($ productSku );
180+ $ response = $ this ->graphQlQuery (
181+ $ query ,
182+ [],
183+ '' ,
184+ $ this ->getCustomerAuthenticationHeader ->execute ('customer@example.com ' , 'password ' )
185+ );
186+
187+ $ this ->assertNotEmpty ($ response ['products ' ]);
188+ $ priceRange = $ response ['products ' ]['items ' ][0 ]['price_range ' ];
189+ $ this ->assertEquals (10.75 , round ($ priceRange ['minimum_price ' ]['regular_price ' ]['value ' ], 2 ));
190+ $ this ->assertEquals (10.75 , round ($ priceRange ['minimum_price ' ]['final_price ' ]['value ' ], 2 ));
191+ $ this ->assertEquals (10.75 , round ($ priceRange ['maximum_price ' ]['regular_price ' ]['value ' ], 2 ));
192+ $ this ->assertEquals (10.75 , round ($ priceRange ['maximum_price ' ]['final_price ' ]['value ' ], 2 ));
193+ }
194+
195+ /**
196+ * Test to make sure tax rule is not applied for a customer in the wrong group
197+ *
198+ * @magentoConfigFixture default_store tax/display/type 2
199+ *
200+ * @magentoApiDataFixture Magento/Customer/_files/customer_with_group_and_address.php
201+ * @magentoApiDataFixture Magento/Customer/_files/second_customer_with_group_and_address.php
202+ * @magentoApiDataFixture Magento/Tax/_files/tax_class_customer_group.php
203+ * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php
204+ */
205+ public function testTaxDisplayDoesNotApplyToWrongCustomerGroup (): void
206+ {
207+ $ productSku = 'simple ' ;
208+ $ query = $ this ->getProductSearchQuery ($ productSku );
209+ $ response = $ this ->graphQlQuery (
210+ $ query ,
211+ [],
212+ '' ,
213+ $ this ->getCustomerAuthenticationHeader ->execute ('secondcustomer@example.com ' , 'password ' )
214+ );
215+
216+ $ this ->assertNotEmpty ($ response ['products ' ]);
217+ $ priceRange = $ response ['products ' ]['items ' ][0 ]['price_range ' ];
218+ $ this ->assertEquals (10 , $ priceRange ['minimum_price ' ]['regular_price ' ]['value ' ]);
219+ $ this ->assertEquals (10 , $ priceRange ['minimum_price ' ]['final_price ' ]['value ' ]);
220+ $ this ->assertEquals (10 , $ priceRange ['maximum_price ' ]['regular_price ' ]['value ' ]);
221+ $ this ->assertEquals (10 , $ priceRange ['maximum_price ' ]['final_price ' ]['value ' ]);
222+ }
223+
116224 /**
117225 * Get a query which user filter for product sku and returns price_tiers
118226 *
0 commit comments