1
1
<?php
2
2
/**
3
- * Copyright © Magento, Inc. All rights reserved.
4
- * See COPYING.txt for license details .
3
+ * Copyright 2020 Adobe
4
+ * All Rights Reserved .
5
5
*/
6
6
declare (strict_types=1 );
7
7
@@ -43,9 +43,9 @@ public function testAllGroups()
43
43
44
44
$ itemTiers = $ response ['products ' ]['items ' ][0 ]['price_tiers ' ];
45
45
$ this ->assertCount (5 , $ itemTiers );
46
- $ this ->assertEquals (round ( 8 * 2 , 2 ) , $ this ->getValueForQuantity (2 , $ itemTiers ));
47
- $ this ->assertEquals (round ( 5 * 3 , 2 ) , $ this ->getValueForQuantity (3 , $ itemTiers ));
48
- $ this ->assertEquals (round ( 6 * 3.2 , 2 ) , $ this ->getValueForQuantity (3.2 , $ itemTiers ));
46
+ $ this ->assertEquals (8 , $ this ->getValueForQuantity (2 , $ itemTiers ));
47
+ $ this ->assertEquals (5 , $ this ->getValueForQuantity (3 , $ itemTiers ));
48
+ $ this ->assertEquals (6 , $ this ->getValueForQuantity (3.2 , $ itemTiers ));
49
49
}
50
50
51
51
/**
@@ -65,11 +65,11 @@ public function testLoggedInCustomer()
65
65
66
66
$ itemTiers = $ response ['products ' ]['items ' ][0 ]['price_tiers ' ];
67
67
$ this ->assertCount (5 , $ itemTiers );
68
- $ this ->assertEquals (round ( 9.25 * 2 , 2 ) , $ this ->getValueForQuantity (2 , $ itemTiers ));
69
- $ this ->assertEquals (round ( 8.25 * 3 , 2 ) , $ this ->getValueForQuantity (3 , $ itemTiers ));
70
- $ this ->assertEquals (round ( 7.25 * 5 , 2 ) , $ this ->getValueForQuantity (5 , $ itemTiers ));
71
- $ this ->assertEquals (round ( 9.00 * 7 , 2 ) , $ this ->getValueForQuantity (7 , $ itemTiers ));
72
- $ this ->assertEquals (round ( 7.25 * 8 , 2 ) , $ this ->getValueForQuantity (8 , $ itemTiers ));
68
+ $ this ->assertEquals (9.25 , $ this ->getValueForQuantity (2 , $ itemTiers ));
69
+ $ this ->assertEquals (8.25 , $ this ->getValueForQuantity (3 , $ itemTiers ));
70
+ $ this ->assertEquals (7.25 , $ this ->getValueForQuantity (5 , $ itemTiers ));
71
+ $ this ->assertEquals (9.00 , $ this ->getValueForQuantity (7 , $ itemTiers ));
72
+ $ this ->assertEquals (7.25 , $ this ->getValueForQuantity (8 , $ itemTiers ));
73
73
}
74
74
75
75
/**
@@ -98,9 +98,9 @@ public function testSecondStoreViewWithCurrencyRate()
98
98
99
99
$ itemTiers = $ response ['products ' ]['items ' ][0 ]['price_tiers ' ];
100
100
$ this ->assertCount (5 , $ itemTiers );
101
- $ this ->assertEquals (round (( 9.25 * 2 ) * $ rate , 2 ), $ this ->getValueForQuantity (2 , $ itemTiers ));
102
- $ this ->assertEquals (round (( 8.25 * 3 ) * $ rate , 2 ), $ this ->getValueForQuantity (3 , $ itemTiers ));
103
- $ this ->assertEquals (round (( 7.25 * 5 ) * $ rate , 2 ), $ this ->getValueForQuantity (5 , $ itemTiers ));
101
+ $ this ->assertEquals (round (9.25 * $ rate , 2 ), $ this ->getValueForQuantity (2 , $ itemTiers ));
102
+ $ this ->assertEquals (round (8.25 * $ rate , 2 ), $ this ->getValueForQuantity (3 , $ itemTiers ));
103
+ $ this ->assertEquals (round (7.25 * $ rate , 2 ), $ this ->getValueForQuantity (5 , $ itemTiers ));
104
104
}
105
105
106
106
/**
@@ -113,8 +113,8 @@ public function testGetLowestPriceForGuest()
113
113
$ response = $ this ->graphQlQuery ($ query );
114
114
$ itemTiers = $ response ['products ' ]['items ' ][0 ]['price_tiers ' ];
115
115
$ this ->assertCount (2 , $ itemTiers );
116
- $ this ->assertEquals (round (( 8.25 * 7 ), 2 ) , $ this ->getValueForQuantity (7 , $ itemTiers ));
117
- $ this ->assertEquals (round (( 7.25 * 8 ), 2 ) , $ this ->getValueForQuantity (8 , $ itemTiers ));
116
+ $ this ->assertEquals (8.25 , $ this ->getValueForQuantity (7 , $ itemTiers ));
117
+ $ this ->assertEquals (7.25 , $ this ->getValueForQuantity (8 , $ itemTiers ));
118
118
}
119
119
120
120
/**
@@ -147,9 +147,7 @@ public function testProductTierPricesAreCorrectlyReturned()
147
147
if (in_array ($ item ['sku ' ], $ productsWithTierPrices )) {
148
148
$ this ->assertCount (1 , $ response ['products ' ]['items ' ][$ key ]['price_tiers ' ]);
149
149
} else {
150
- if (empty ($ response ['products ' ]['items ' ][$ key ]['price_tiers ' ])) {
151
- $ this ->assertCount (0 , $ response ['products ' ]['items ' ][$ key ]['price_tiers ' ]);
152
- }
150
+ $ this ->assertCount (0 , $ response ['products ' ]['items ' ][$ key ]['price_tiers ' ]);
153
151
}
154
152
}
155
153
}
0 commit comments