Skip to content

Commit b347620

Browse files
ENGCOM-6281: Add Poland regions #25590
2 parents 084df58 + 740bd79 commit b347620

File tree

3 files changed

+105
-2
lines changed

3 files changed

+105
-2
lines changed

app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292
<item>Piwowarska 6</item>
293293
</array>
294294
<data key="city">Bielsko-Biała</data>
295-
<data key="state"> Bielsko</data>
295+
<data key="state">śląskie</data>
296296
<data key="country_id">PL</data>
297297
<data key="country">Poland</data>
298298
<data key="postcode">43-310</data>

app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryPolandTest.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickOnEditButton"/>
3535
<waitForPageLoad stepKey="waitForCustomerEditPageToLoad"/>
3636

37-
<!--Add the Address -->
37+
<!-- Add the Address -->
3838
<click selector="{{AdminEditCustomerAddressesSection.addresses}}" stepKey="selectAddress"/>
3939
<waitForPageLoad stepKey="waitForAddressPageToLoad"/>
4040
<click selector="{{AdminEditCustomerAddressesSection.addNewAddress}}" stepKey="ClickOnAddNewAddressButton"/>
@@ -44,6 +44,7 @@
4444
<fillField selector="{{AdminEditCustomerAddressesSection.city}}" userInput="{{PolandAddress.city}}" stepKey="fillCity"/>
4545
<scrollTo selector="{{AdminEditCustomerAddressesSection.phone}}" x="0" y="-80" stepKey="scrollToPhone"/>
4646
<selectOption selector="{{AdminEditCustomerAddressesSection.country}}" userInput="{{PolandAddress.country}}" stepKey="fillCountry"/>
47+
<selectOption selector="{{AdminEditCustomerAddressesSection.state}}" userInput="{{PolandAddress.state}}" stepKey="fillState"/>
4748
<fillField selector="{{AdminEditCustomerAddressesSection.zipCode}}" userInput="{{PolandAddress.postcode}}" stepKey="fillPostCode"/>
4849
<fillField selector="{{AdminEditCustomerAddressesSection.phone}}" userInput="{{PolandAddress.telephone}}" stepKey="fillPhoneNumber"/>
4950
<scrollToTopOfPage stepKey="scrollToTopOfPage"/>
@@ -60,6 +61,7 @@
6061
<see userInput="$$createCustomer.firstname$$" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertFirstName"/>
6162
<see userInput="$$createCustomer.lastname$$" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertLastName"/>
6263
<see userInput="$$createCustomer.email$$" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertEmail"/>
64+
<see userInput="{{PolandAddress.state}}" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertState"/>
6365
<see userInput="{{PolandAddress.country}}" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertCountry"/>
6466
<see userInput="{{PolandAddress.postcode}}" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertPostCode"/>
6567
<see userInput="{{PolandAddress.telephone}}" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertPhoneNumber"/>
@@ -86,6 +88,7 @@
8688
<see selector="{{AdminCustomerAddressesGridSection.customerAddressGrid}}" userInput="{{PolandAddress.street}}" stepKey="seeStreetAddress"/>
8789
<see selector="{{AdminCustomerAddressesGridSection.customerAddressGrid}}" userInput="{{PolandAddress.city}}" stepKey="seeCity"/>
8890
<see selector="{{AdminCustomerAddressesGridSection.customerAddressGrid}}" userInput="{{PolandAddress.country}}" stepKey="seeCountry"/>
91+
<see selector="{{AdminCustomerAddressesGridSection.customerAddressGrid}}" userInput="{{PolandAddress.state}}" stepKey="seeState"/>
8992
<see selector="{{AdminCustomerAddressesGridSection.customerAddressGrid}}" userInput="{{PolandAddress.postcode}}" stepKey="seePostCode"/>
9093
<see selector="{{AdminCustomerAddressesGridSection.customerAddressGrid}}" userInput="{{PolandAddress.telephone}}" stepKey="seePhoneNumber"/>
9194
</test>
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See PLPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Directory\Setup\Patch\Data;
10+
11+
use Magento\Directory\Setup\DataInstaller;
12+
use Magento\Directory\Setup\DataInstallerFactory;
13+
use Magento\Framework\Setup\ModuleDataSetupInterface;
14+
use Magento\Framework\Setup\Patch\DataPatchInterface;
15+
16+
/**
17+
* Add Poland States
18+
*/
19+
class AddDataForPoland implements DataPatchInterface
20+
{
21+
/**
22+
* @var ModuleDataSetupInterface
23+
*/
24+
private $moduleDataSetup;
25+
26+
/**
27+
* @var DataInstallerFactory
28+
*/
29+
private $dataInstallerFactory;
30+
31+
/**
32+
* @param ModuleDataSetupInterface $moduleDataSetup
33+
* @param DataInstallerFactory $dataInstallerFactory
34+
*/
35+
public function __construct(
36+
ModuleDataSetupInterface $moduleDataSetup,
37+
DataInstallerFactory $dataInstallerFactory
38+
) {
39+
$this->moduleDataSetup = $moduleDataSetup;
40+
$this->dataInstallerFactory = $dataInstallerFactory;
41+
}
42+
43+
/**
44+
* @inheritdoc
45+
*/
46+
public function apply()
47+
{
48+
/** @var DataInstaller $dataInstaller */
49+
$dataInstaller = $this->dataInstallerFactory->create();
50+
$dataInstaller->addCountryRegions(
51+
$this->moduleDataSetup->getConnection(),
52+
$this->getDataForPoland()
53+
);
54+
}
55+
56+
/**
57+
* Poland states data.
58+
*
59+
* @return array
60+
*/
61+
private function getDataForPoland()
62+
{
63+
return [
64+
['PL', 'PL-02', 'dolnośląskie'],
65+
['PL', 'PL-04', 'kujawsko-pomorskie'],
66+
['PL', 'PL-06', 'lubelskie'],
67+
['PL', 'PL-08', 'lubuskie'],
68+
['PL', 'PL-10', 'łódzkie'],
69+
['PL', 'PL-12', 'małopolskie'],
70+
['PL', 'PL-14', 'mazowieckie'],
71+
['PL', 'PL-16', 'opolskie'],
72+
['PL', 'PL-18', 'podkarpackie'],
73+
['PL', 'PL-20', 'podlaskie'],
74+
['PL', 'PL-22', 'pomorskie'],
75+
['PL', 'PL-24', 'śląskie'],
76+
['PL', 'PL-26', 'świętokrzyskie'],
77+
['PL', 'PL-28', 'warmińsko-mazurskie'],
78+
['PL', 'PL-30', 'wielkopolskie'],
79+
['PL', 'PL-32', 'zachodniopomorskie'],
80+
];
81+
}
82+
83+
/**
84+
* @inheritdoc
85+
*/
86+
public static function getDependencies()
87+
{
88+
return [
89+
InitializeDirectoryData::class,
90+
];
91+
}
92+
93+
/**
94+
* @inheritdoc
95+
*/
96+
public function getAliases()
97+
{
98+
return [];
99+
}
100+
}

0 commit comments

Comments
 (0)