Skip to content

Commit 2fa2208

Browse files
ashishkumarpundeerashishkumarpundeer
authored andcommitted
AC-9340::Error occurs during Region id Processing while multi-shipping checkout
1 parent ad8743e commit 2fa2208

File tree

3 files changed

+19
-196
lines changed

3 files changed

+19
-196
lines changed

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Attribute/GetRegionIdTest.php

Lines changed: 0 additions & 195 deletions
This file was deleted.

app/code/Magento/Customer/Model/Address/AbstractAddress.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ public function getRegionId()
454454
(string)$this->getCountryId()
455455
);
456456
if (empty($regionId)) {
457-
return $this->getData('region_id');
457+
$regionId = $this->getData('region_id');
458458
}
459459
$this->setData('region_id', $regionId);
460460
}

app/code/Magento/Customer/Test/Unit/Model/Address/AbstractAddressTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,24 @@ public function testGetRegionCodeWithRegionId()
162162
$this->assertEquals('UK', $this->model->getRegionCode());
163163
}
164164

165+
166+
public function testGetRegionId()
167+
{
168+
$this->model->setData('region_id', 0);
169+
$this->model->setData('region', '');
170+
$this->model->setData('country_id', 'GB');
171+
$region = $this->getMockBuilder(Region::class)
172+
->addMethods(['getCountryId', 'getCode'])
173+
->onlyMethods(['__wakeup', 'load', 'loadByCode','getId'])
174+
->disableOriginalConstructor()
175+
->getMock();
176+
$region->method('loadByCode')
177+
->willReturnSelf();
178+
$this->regionFactoryMock->method('create')
179+
->willReturn($region);
180+
$this->assertEquals(0, $this->model->getRegionId());
181+
}
182+
165183
public function testGetRegionCodeWithRegion()
166184
{
167185
$countryId = 2;

0 commit comments

Comments
 (0)