Skip to content

Commit eb02b42

Browse files
committed
ACP2E-209: "Table rate" shipping method displays as "Not yet calculated" on checkout
Integration test failures fixed.
1 parent 75477b6 commit eb02b42

File tree

1 file changed

+51
-53
lines changed

1 file changed

+51
-53
lines changed

dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -128,59 +128,6 @@ public function testTableRateFreeShipping()
128128
}
129129
}
130130

131-
/**
132-
*
133-
* Test table rate with zero amount is available for the cart when discount coupon cart price rule to all items
134-
* and freeshipping cart price rule is applied when order subtotal is greater than specified amount.
135-
*
136-
* @magentoConfigFixture current_store carriers/tablerate/active 1
137-
* @magentoConfigFixture current_store carriers/flatrate/active 0
138-
* @magentoConfigFixture current_store carriers/freeshipping/active 0
139-
* @magentoConfigFixture default_store carriers/tablerate/condition_name package_value_with_discount
140-
* @magentoDataFixture Magento/Catalog/_files/categories.php
141-
* @magentoDataFixture Magento/SalesRule/_files/cart_rule_free_shipping_subtotal_equals_more_than_30.php
142-
* @magentoDataFixture Magento/SalesRule/_files/cart_rule_20_percent_off_with_coupon_no_condition.php
143-
* @magentoDataFixture Magento/Sales/_files/quote_with_multiple_products.php
144-
* @magentoDataFixture Magento/OfflineShipping/_files/tablerates_price.php
145-
*
146-
* @return void
147-
*/
148-
public function testTableRateWithZeroPriceShownWhenDiscountCouponAndFreeShippingCartRuleApplied()
149-
{
150-
$objectManager = Bootstrap::getObjectManager();
151-
$quote = $this->getQuote('tableRate');
152-
$cartId = $quote->getId();
153-
if (!$cartId) {
154-
$this->fail('quote fixture failed');
155-
}
156-
/** @var QuoteIdMask $quoteIdMask */
157-
$quoteIdMask = Bootstrap::getObjectManager()
158-
->create(QuoteIdMaskFactory::class)
159-
->create();
160-
$quoteIdMask->load($cartId, 'quote_id');
161-
//Use masked cart Id
162-
$cartId = $quoteIdMask->getMaskedId();
163-
$addressFactory = $this->objectManager->get(AddressInterfaceFactory::class);
164-
/** @var \Magento\Quote\Api\Data\AddressInterface $address */
165-
$address = $addressFactory->create();
166-
$address->setCountryId('US');
167-
/** @var CouponManagementInterface $couponManagement */
168-
$couponManagement = Bootstrap::getObjectManager()->get(CouponManagementInterface::class);
169-
$couponManagement->set($quote->getId(), '123');
170-
/** @var GuestShippingMethodManagementInterface $shippingEstimation */
171-
$shippingEstimation = $objectManager->get(GuestShippingMethodManagementInterface::class);
172-
$result = $shippingEstimation->estimateByExtendedAddress($cartId, $address);
173-
$this->assertCount(1, $result);
174-
$rate = reset($result);
175-
176-
$expectedResult = [
177-
'method_code' => 'bestway',
178-
'amount' => 0
179-
];
180-
$this->assertEquals($expectedResult['method_code'], $rate->getMethodCode());
181-
$this->assertEquals($expectedResult['amount'], $rate->getAmount());
182-
}
183-
184131
/**
185132
* Test table rate amount for the cart that contains some items with free shipping applied.
186133
*
@@ -501,4 +448,55 @@ private function setConfig(int $customerGroupId, int $productTaxClassId): void
501448
$config->setValue($data['path'], $data['value'], $data['scope']);
502449
}
503450
}
451+
452+
/**
453+
*
454+
* Test table rate with zero amount is available for the cart when discount coupon cart price rule to all items
455+
* and freeshipping cart price rule is applied when order subtotal is greater than specified amount.
456+
*
457+
* @magentoConfigFixture default_store carriers/tablerate/active 1
458+
* @magentoConfigFixture default_store carriers/flatrate/active 0
459+
* @magentoConfigFixture default_store carriers/freeshipping/active 0
460+
* @magentoConfigFixture default_store carriers/tablerate/condition_name package_value_with_discount
461+
* @magentoDataFixture Magento/SalesRule/_files/cart_rule_free_shipping_subtotal_equals_more_than_30.php
462+
* @magentoDataFixture Magento/SalesRule/_files/cart_rule_20_percent_off_with_coupon_no_condition.php
463+
* @magentoDataFixture Magento/Sales/_files/quote_with_multiple_products.php
464+
* @magentoDataFixture Magento/OfflineShipping/_files/tablerates_price.php
465+
* @return void
466+
*/
467+
public function testTableRateWithZeroPriceShownWhenDiscountCouponAndFreeShippingCartRuleApplied()
468+
{
469+
$objectManager = Bootstrap::getObjectManager();
470+
$quote = $this->getQuote('tableRate');
471+
$cartId = $quote->getId();
472+
if (!$cartId) {
473+
$this->fail('quote fixture failed');
474+
}
475+
/** @var QuoteIdMask $quoteIdMask */
476+
$quoteIdMask = Bootstrap::getObjectManager()
477+
->create(QuoteIdMaskFactory::class)
478+
->create();
479+
$quoteIdMask->load($cartId, 'quote_id');
480+
//Use masked cart Id
481+
$cartId = $quoteIdMask->getMaskedId();
482+
$addressFactory = $this->objectManager->get(AddressInterfaceFactory::class);
483+
/** @var \Magento\Quote\Api\Data\AddressInterface $address */
484+
$address = $addressFactory->create();
485+
$address->setCountryId('US');
486+
/** @var CouponManagementInterface $couponManagement */
487+
$couponManagement = Bootstrap::getObjectManager()->get(CouponManagementInterface::class);
488+
$couponManagement->set($quote->getId(), '123');
489+
/** @var GuestShippingMethodManagementInterface $shippingEstimation */
490+
$shippingEstimation = $objectManager->get(GuestShippingMethodManagementInterface::class);
491+
$result = $shippingEstimation->estimateByExtendedAddress($cartId, $address);
492+
$this->assertCount(1, $result);
493+
$rate = reset($result);
494+
495+
$expectedResult = [
496+
'method_code' => 'bestway',
497+
'amount' => 0
498+
];
499+
$this->assertEquals($expectedResult['method_code'], $rate->getMethodCode());
500+
$this->assertEquals($expectedResult['amount'], $rate->getAmount());
501+
}
504502
}

0 commit comments

Comments
 (0)