Skip to content

Commit 725af90

Browse files
committed
MC-33459: Magento\Quote\Model\ShippingMethodManagementTest::testEstimateByAddressWithInclExclTaxAndVATGroup failed for 2.4-develop
1 parent 5f1159b commit 725af90

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -303,17 +303,15 @@ private function executeTestFlow($flatRateAmount, $tableRateAmount)
303303
*/
304304
public function testEstimateByAddressWithInclExclTaxAndVATGroup()
305305
{
306-
$this->mockCustomerVat();
307-
308-
/** @var CustomerRepositoryInterface $customerRepository */
309-
$customerRepository = $this->objectManager->get(CustomerRepositoryInterface::class);
310-
$customer = $customerRepository->get('customer@example.com');
311-
312306
/** @var GroupInterface $customerGroup */
313307
$customerGroup = $this->findCustomerGroupByCode('custom_group');
308+
$this->mockCustomerVat((int)$customerGroup->getId());
309+
314310
$customerGroup->setTaxClassId($this->getTaxClass('CustomerTaxClass')->getClassId());
315311
$this->groupRepository->save($customerGroup);
316-
312+
/** @var CustomerRepositoryInterface $customerRepository */
313+
$customerRepository = $this->objectManager->get(CustomerRepositoryInterface::class);
314+
$customer = $customerRepository->get('customer@example.com');
317315
$customer->setGroupId($customerGroup->getId());
318316
$customer->setTaxvat('12');
319317
$customerRepository->save($customer);
@@ -332,8 +330,10 @@ public function testEstimateByAddressWithInclExclTaxAndVATGroup()
332330

333331
/**
334332
* Create a test double fot customer vat class
333+
*
334+
* @param int $customerGroupId
335335
*/
336-
private function mockCustomerVat(): void
336+
private function mockCustomerVat(int $customerGroupId): void
337337
{
338338
$gatewayResponse = new DataObject([
339339
'is_valid' => false,
@@ -356,14 +356,12 @@ private function mockCustomerVat(): void
356356
$customerVat->method('isCountryInEU')->willReturn(true);
357357
$customerVat->method('getMerchantCountryCode')->willReturn('GB');
358358
$customerVat->method('getMerchantVatNumber')->willReturn('11111');
359-
$customerVat->method('getCustomerGroupIdBasedOnVatNumber')->willReturn('4');
359+
$customerVat->method('getCustomerGroupIdBasedOnVatNumber')->willReturn($customerGroupId);
360360
$this->objectManager->removeSharedInstance(Vat::class);
361361
$this->objectManager->addSharedInstance($customerVat, Vat::class);
362362

363363
// Remove instances where the customer vat object is cached
364364
$this->objectManager->removeSharedInstance(CollectTotalsObserver::class);
365-
$this->objectManager->removeSharedInstance(AfterAddressSaveObserver::class);
366-
$this->objectManager->removeSharedInstance(VatValidator::class);
367365
}
368366

369367
/**

0 commit comments

Comments
 (0)