Skip to content

Commit 5cd7496

Browse files
committed
Merge remote-tracking branch 'magento-mpi/MC-20346' into MPI-PR
# Conflicts: # app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml
2 parents 7e7befb + 7774abc commit 5cd7496

File tree

3 files changed

+160
-0
lines changed

3 files changed

+160
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,4 +360,19 @@
360360
<data key="default_shipping">Yes</data>
361361
<requiredEntity type="region">RegionAE</requiredEntity>
362362
</entity>
363+
<entity name="updateCustomerBelgiumAddress" type="address">
364+
<data key="firstname">John</data>
365+
<data key="lastname">Doe</data>
366+
<data key="company">Magento</data>
367+
<array key="street">
368+
<item>Chaussee de Wavre</item>
369+
<item>318</item>
370+
</array>
371+
<data key="city">Bihain</data>
372+
<data key="state">Hainaut</data>
373+
<data key="country_id">BE</data>
374+
<data key="country">Belgium</data>
375+
<data key="postcode">6690</data>
376+
<data key="telephone">0477-58-77867</data>
377+
</entity>
363378
</entities>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontUpdateCustomerAddressBelgiumTest">
12+
<annotations>
13+
<stories value="Update Regions list for Belgium country"/>
14+
<title value="Update customer address on storefront with Belgium address"/>
15+
<description value="Update customer address on storefront with Belgium address and verify you can select a region"/>
16+
<testCaseId value="MC-20234"/>
17+
<severity value="AVERAGE"/>
18+
<group value="customer"/>
19+
</annotations>
20+
21+
<before>
22+
<actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/>
23+
<actionGroup ref="SignUpNewUserFromStorefrontActionGroup" stepKey="SignUpNewUser">
24+
<argument name="Customer" value="CustomerEntityOne"/>
25+
</actionGroup>
26+
</before>
27+
<after>
28+
<actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteNewUser">
29+
<argument name="email" value="{{CustomerEntityOne.email}}"/>
30+
</actionGroup>
31+
<actionGroup ref="logout" stepKey="logout"/>
32+
</after>
33+
34+
<!--Update customer address Belgium in storefront-->
35+
<actionGroup ref="EnterCustomerAddressInfo" stepKey="enterAddress">
36+
<argument name="Address" value="updateCustomerBelgiumAddress"/>
37+
</actionGroup>
38+
<!--Verify customer address save success message-->
39+
<see selector="{{AdminCustomerMessagesSection.successMessage}}" userInput="You saved the address." stepKey="seeAssertCustomerAddressSuccessSaveMessage"/>
40+
41+
<!--Verify customer default billing address-->
42+
<actionGroup ref="VerifyCustomerBillingAddressWithState" stepKey="verifyBillingAddress">
43+
<argument name="address" value="updateCustomerBelgiumAddress"/>
44+
</actionGroup>
45+
46+
<!--Verify customer default shipping address-->
47+
<actionGroup ref="VerifyCustomerShippingAddressWithState" stepKey="verifyShippingAddress">
48+
<argument name="address" value="updateCustomerBelgiumAddress"/>
49+
</actionGroup>
50+
</test>
51+
</tests>
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Directory\Setup\Patch\Data;
8+
9+
use Magento\Directory\Setup\DataInstaller;
10+
use Magento\Framework\Setup\ModuleDataSetupInterface;
11+
use Magento\Framework\Setup\Patch\DataPatchInterface;
12+
13+
/**
14+
* Add Regions for Belgium.
15+
*/
16+
class AddDataForBelgium implements DataPatchInterface
17+
{
18+
/**
19+
* @var ModuleDataSetupInterface
20+
*/
21+
private $moduleDataSetup;
22+
23+
/**
24+
* @var \Magento\Directory\Setup\DataInstallerFactory
25+
*/
26+
private $dataInstallerFactory;
27+
28+
/**
29+
* @param ModuleDataSetupInterface $moduleDataSetup
30+
* @param \Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory
31+
*/
32+
public function __construct(
33+
ModuleDataSetupInterface $moduleDataSetup,
34+
\Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory
35+
) {
36+
$this->moduleDataSetup = $moduleDataSetup;
37+
$this->dataInstallerFactory = $dataInstallerFactory;
38+
}
39+
40+
/**
41+
* @inheritdoc
42+
*/
43+
public function apply()
44+
{
45+
/** @var DataInstaller $dataInstaller */
46+
$dataInstaller = $this->dataInstallerFactory->create();
47+
$dataInstaller->addCountryRegions(
48+
$this->moduleDataSetup->getConnection(),
49+
$this->getDataForBelgium()
50+
);
51+
}
52+
53+
/**
54+
* Belgium states data.
55+
*
56+
* @return array
57+
*/
58+
private function getDataForBelgium()
59+
{
60+
return [
61+
['BE', 'VAN', 'Antwerpen'],
62+
['BE', 'WBR', 'Brabant wallon'],
63+
['BE', 'BRU', 'Brussels Hoofdstedelijk Gewest'],
64+
['BE', 'WHT', 'Hainaut'],
65+
['BE', 'VLI', 'Limburg'],
66+
['BE', 'WLG', 'Liege'],
67+
['BE', 'WLX', 'Luxembourg'],
68+
['BE', 'WNA', 'Namur'],
69+
['BE', 'VOV', 'Oost-Vlaanderen'],
70+
['BE', 'VLG', 'Vlaams Gewest'],
71+
['BE', 'VBR', 'Vlaams-Brabant'],
72+
['BE', 'VWV', 'West-Vlaanderen'],
73+
['BE', 'WAL', 'Wallonne, Region']
74+
];
75+
}
76+
77+
/**
78+
* @inheritdoc
79+
*/
80+
public static function getDependencies()
81+
{
82+
return [
83+
InitializeDirectoryData::class,
84+
];
85+
}
86+
87+
/**
88+
* @inheritdoc
89+
*/
90+
public function getAliases()
91+
{
92+
return [];
93+
}
94+
}

0 commit comments

Comments
 (0)