Skip to content

Commit 30b4b45

Browse files
pradeep.rauthanpradeep.rauthan
authored andcommitted
MC-42623:Countries list is incorrect when using different countries per website and Global Customer Account settings - Integration test coverage implemented
1 parent 42eefb5 commit 30b4b45

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Address/StoreAddressCollectionTest.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,14 @@ public function testSetCustomerFilter()
2929
$allowedCountriesObj = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
3030
\Magento\Directory\Model\AllowedCountries::class
3131
);
32-
$storeId = $customer->getStoreId();
33-
$allowedCountries = $allowedCountriesObj->getAllowedCountries(ScopeInterface::SCOPE_STORE, $storeId);
34-
$strAllowedCountries = implode("%S, %S", $allowedCountries);
35-
$this->assertStringMatchesFormat('%AWHERE%S(%Scountry_id%S IN(%S' . $strAllowedCountries . '%S))%A', (string)$select);
32+
$format = '%AWHERE%S(%Sparent_id%S IN(%S1%S, %S2%S))%SAND%S(%Sparent_id%S = %S-1%S)%SAND%S(%Sparent_id%S = %S3%S)%A';
33+
$storeId = $customer->getStoreId() ?? null;
34+
if ($storeId) {
35+
$allowedCountries = $allowedCountriesObj->getAllowedCountries(ScopeInterface::SCOPE_STORE, $storeId);
36+
$strAllowedCountries = implode("%S, %S", $allowedCountries);
37+
$format = '%AWHERE%S(%Sparent_id%S IN(%S1%S, %S2%S))%SAND%S(%Sparent_id%S = %S-1%S)' .
38+
'%SAND%S(%Sparent_id%S = %S3%S)%SAND%S(%Scountry_id%S IN(%S' . $strAllowedCountries . '%S))%A';
39+
}
40+
$this->assertStringMatchesFormat($format, (string)$select);
3641
}
3742
}

0 commit comments

Comments
 (0)