@@ -42,62 +42,75 @@ protected function setUp()
42
42
}
43
43
44
44
/**
45
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_tax_guest.php
45
+ * @magentoApiDataFixture Magento/GraphQl/Tax/_files/tax_rule_for_region_1.php
46
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
47
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/apply_tax_for_simple_product.php
48
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
49
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
50
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
51
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_billing_address.php
46
52
*/
47
53
public function testGetCartTotalsWithTaxApplied ()
48
54
{
49
- $ maskedQuoteId = $ this ->getMaskedQuoteIdByReversedQuoteId ('test_order_tax ' );
55
+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReversedQuoteId ('test_quote ' );
50
56
$ query = $ this ->getCartTotalsGraphqlQuery ($ maskedQuoteId );
51
57
$ response = $ this ->graphQlQuery ($ query );
52
58
53
59
self ::assertArrayHasKey ('prices ' , $ response ['cart ' ]);
54
60
$ pricesResponse = $ response ['cart ' ]['prices ' ];
55
- self ::assertEquals (10.83 , $ pricesResponse ['grand_total ' ]['value ' ]);
56
- self ::assertEquals (10.83 , $ pricesResponse ['subtotal_including_tax ' ]['value ' ]);
57
- self ::assertEquals (10 , $ pricesResponse ['subtotal_excluding_tax ' ]['value ' ]);
58
- self ::assertEquals (10 , $ pricesResponse ['subtotal_with_discount_excluding_tax ' ]['value ' ]);
61
+ self ::assertEquals (21.5 , $ pricesResponse ['grand_total ' ]['value ' ]);
62
+ self ::assertEquals (21.5 , $ pricesResponse ['subtotal_including_tax ' ]['value ' ]);
63
+ self ::assertEquals (20 , $ pricesResponse ['subtotal_excluding_tax ' ]['value ' ]);
64
+ self ::assertEquals (20 , $ pricesResponse ['subtotal_with_discount_excluding_tax ' ]['value ' ]);
59
65
60
66
$ appliedTaxesResponse = $ pricesResponse ['applied_taxes ' ];
61
67
62
- self ::assertEquals ('US-CA -*-Rate 1 ' , $ appliedTaxesResponse [0 ]['label ' ]);
63
- self ::assertEquals (0.83 , $ appliedTaxesResponse [0 ]['amount ' ]['value ' ]);
68
+ self ::assertEquals ('US-TEST -*-Rate- 1 ' , $ appliedTaxesResponse [0 ]['label ' ]);
69
+ self ::assertEquals (1.5 , $ appliedTaxesResponse [0 ]['amount ' ]['value ' ]);
64
70
self ::assertEquals ('USD ' , $ appliedTaxesResponse [0 ]['amount ' ]['currency ' ]);
65
71
}
66
72
67
73
/**
68
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_guest.php
74
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
75
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
76
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
77
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
78
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_billing_address.php
69
79
*/
70
80
public function testGetTotalsWithNoTaxApplied ()
71
81
{
72
- $ maskedQuoteId = $ this ->getMaskedQuoteIdByReversedQuoteId ('test_order_1 ' );
82
+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReversedQuoteId ('test_quote ' );
73
83
$ query = $ this ->getCartTotalsGraphqlQuery ($ maskedQuoteId );
74
84
$ response = $ this ->graphQlQuery ($ query );
75
85
76
86
$ pricesResponse = $ response ['cart ' ]['prices ' ];
77
- self ::assertEquals (10 , $ pricesResponse ['grand_total ' ]['value ' ]);
78
- self ::assertEquals (10 , $ pricesResponse ['subtotal_including_tax ' ]['value ' ]);
79
- self ::assertEquals (10 , $ pricesResponse ['subtotal_excluding_tax ' ]['value ' ]);
80
- self ::assertEquals (10 , $ pricesResponse ['subtotal_with_discount_excluding_tax ' ]['value ' ]);
87
+ self ::assertEquals (20 , $ pricesResponse ['grand_total ' ]['value ' ]);
88
+ self ::assertEquals (20 , $ pricesResponse ['subtotal_including_tax ' ]['value ' ]);
89
+ self ::assertEquals (20 , $ pricesResponse ['subtotal_excluding_tax ' ]['value ' ]);
90
+ self ::assertEquals (20 , $ pricesResponse ['subtotal_with_discount_excluding_tax ' ]['value ' ]);
81
91
self ::assertEmpty ($ pricesResponse ['applied_taxes ' ]);
82
92
}
83
93
84
94
/**
85
95
* The totals calculation is based on quote address.
86
96
* But the totals should be calculated even if no address is set
87
97
*
88
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
98
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
99
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
100
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
101
+ * @group recent
89
102
*/
90
103
public function testGetCartTotalsWithNoAddressSet ()
91
104
{
92
- $ maskedQuoteId = $ this ->getMaskedQuoteIdByReversedQuoteId ('test_order_with_simple_product_without_address ' );
105
+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReversedQuoteId ('test_quote ' );
93
106
$ query = $ this ->getCartTotalsGraphqlQuery ($ maskedQuoteId );
94
107
$ response = $ this ->graphQlQuery ($ query );
95
108
96
109
$ pricesResponse = $ response ['cart ' ]['prices ' ];
97
- self ::assertEquals (10 , $ pricesResponse ['grand_total ' ]['value ' ]);
98
- self ::assertEquals (10 , $ pricesResponse ['subtotal_including_tax ' ]['value ' ]);
99
- self ::assertEquals (10 , $ pricesResponse ['subtotal_excluding_tax ' ]['value ' ]);
100
- self ::assertEquals (10 , $ pricesResponse ['subtotal_with_discount_excluding_tax ' ]['value ' ]);
110
+ self ::assertEquals (20 , $ pricesResponse ['grand_total ' ]['value ' ]);
111
+ self ::assertEquals (20 , $ pricesResponse ['subtotal_including_tax ' ]['value ' ]);
112
+ self ::assertEquals (20 , $ pricesResponse ['subtotal_excluding_tax ' ]['value ' ]);
113
+ self ::assertEquals (20 , $ pricesResponse ['subtotal_with_discount_excluding_tax ' ]['value ' ]);
101
114
self ::assertEmpty ($ pricesResponse ['applied_taxes ' ]);
102
115
}
103
116
0 commit comments