This repository has been archived by the owner on Dec 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4875 from magento-mpi/MPI-PR-2019-10-07
MPI-PR-2019-10-07
- Loading branch information
Showing
41 changed files
with
1,319 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Catalog\Model\Product; | ||
|
||
use Magento\Framework\EntityManager\HydratorInterface; | ||
|
||
/** | ||
* Class is used to extract data and populate entity with data | ||
*/ | ||
class Hydrator implements HydratorInterface | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function extract($entity) | ||
{ | ||
return $entity->getData(); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function hydrate($entity, array $data) | ||
{ | ||
$lockedAttributes = $entity->getLockedAttributes(); | ||
$entity->unlockAttributes(); | ||
$entity->setData(array_merge($entity->getData(), $data)); | ||
foreach ($lockedAttributes as $attribute) { | ||
$entity->lockAttribute($attribute); | ||
} | ||
|
||
return $entity; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressBelgiumTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> | ||
<test name="StorefrontUpdateCustomerAddressBelgiumTest"> | ||
<annotations> | ||
<stories value="Update Regions list for Belgium country"/> | ||
<title value="Update customer address on storefront with Belgium address"/> | ||
<description value="Update customer address on storefront with Belgium address and verify you can select a region"/> | ||
<testCaseId value="MC-20234"/> | ||
<severity value="AVERAGE"/> | ||
<group value="customer"/> | ||
</annotations> | ||
|
||
<before> | ||
<actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/> | ||
<actionGroup ref="SignUpNewUserFromStorefrontActionGroup" stepKey="SignUpNewUser"> | ||
<argument name="Customer" value="CustomerEntityOne"/> | ||
</actionGroup> | ||
</before> | ||
<after> | ||
<actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteNewUser"> | ||
<argument name="email" value="{{CustomerEntityOne.email}}"/> | ||
</actionGroup> | ||
<actionGroup ref="logout" stepKey="logout"/> | ||
</after> | ||
|
||
<!--Update customer address Belgium in storefront--> | ||
<actionGroup ref="EnterCustomerAddressInfo" stepKey="enterAddress"> | ||
<argument name="Address" value="updateCustomerBelgiumAddress"/> | ||
</actionGroup> | ||
<!--Verify customer address save success message--> | ||
<see selector="{{AdminCustomerMessagesSection.successMessage}}" userInput="You saved the address." stepKey="seeAssertCustomerAddressSuccessSaveMessage"/> | ||
|
||
<!--Verify customer default billing address--> | ||
<actionGroup ref="VerifyCustomerBillingAddressWithState" stepKey="verifyBillingAddress"> | ||
<argument name="address" value="updateCustomerBelgiumAddress"/> | ||
</actionGroup> | ||
|
||
<!--Verify customer default shipping address--> | ||
<actionGroup ref="VerifyCustomerShippingAddressWithState" stepKey="verifyShippingAddress"> | ||
<argument name="address" value="updateCustomerBelgiumAddress"/> | ||
</actionGroup> | ||
</test> | ||
</tests> |
51 changes: 51 additions & 0 deletions
51
app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressChinaTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> | ||
<test name="StorefrontUpdateCustomerAddressChinaTest"> | ||
<annotations> | ||
<stories value="Update Regions list for China country"/> | ||
<title value="Update customer address on storefront with china address"/> | ||
<description value="Update customer address on storefront with china address and verify you can select a region"/> | ||
<testCaseId value="MC-20234"/> | ||
<severity value="AVERAGE"/> | ||
<group value="customer"/> | ||
</annotations> | ||
|
||
<before> | ||
<actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/> | ||
<actionGroup ref="SignUpNewUserFromStorefrontActionGroup" stepKey="SignUpNewUser"> | ||
<argument name="Customer" value="CustomerEntityOne"/> | ||
</actionGroup> | ||
</before> | ||
<after> | ||
<actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteNewUser"> | ||
<argument name="email" value="{{CustomerEntityOne.email}}"/> | ||
</actionGroup> | ||
<actionGroup ref="logout" stepKey="logout"/> | ||
</after> | ||
|
||
<!--Update customer address in storefront--> | ||
<actionGroup ref="EnterCustomerAddressInfo" stepKey="enterAddress"> | ||
<argument name="Address" value="updateCustomerChinaAddress"/> | ||
</actionGroup> | ||
<!--Verify customer address save success message--> | ||
<see selector="{{AdminCustomerMessagesSection.successMessage}}" userInput="You saved the address." stepKey="seeAssertCustomerAddressSuccessSaveMessage"/> | ||
|
||
<!--Verify customer default billing address--> | ||
<actionGroup ref="VerifyCustomerBillingAddressWithState" stepKey="verifyBillingAddress"> | ||
<argument name="address" value="updateCustomerChinaAddress"/> | ||
</actionGroup> | ||
|
||
<!--Verify customer default shipping address--> | ||
<actionGroup ref="VerifyCustomerShippingAddressWithState" stepKey="verifyShippingAddress"> | ||
<argument name="address" value="updateCustomerChinaAddress"/> | ||
</actionGroup> | ||
</test> | ||
</tests> |
94 changes: 94 additions & 0 deletions
94
app/code/Magento/Directory/Setup/Patch/Data/AddDataForBelgium.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Directory\Setup\Patch\Data; | ||
|
||
use Magento\Directory\Setup\DataInstaller; | ||
use Magento\Framework\Setup\ModuleDataSetupInterface; | ||
use Magento\Framework\Setup\Patch\DataPatchInterface; | ||
|
||
/** | ||
* Add Regions for Belgium. | ||
*/ | ||
class AddDataForBelgium implements DataPatchInterface | ||
{ | ||
/** | ||
* @var ModuleDataSetupInterface | ||
*/ | ||
private $moduleDataSetup; | ||
|
||
/** | ||
* @var \Magento\Directory\Setup\DataInstallerFactory | ||
*/ | ||
private $dataInstallerFactory; | ||
|
||
/** | ||
* @param ModuleDataSetupInterface $moduleDataSetup | ||
* @param \Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory | ||
*/ | ||
public function __construct( | ||
ModuleDataSetupInterface $moduleDataSetup, | ||
\Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory | ||
) { | ||
$this->moduleDataSetup = $moduleDataSetup; | ||
$this->dataInstallerFactory = $dataInstallerFactory; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function apply() | ||
{ | ||
/** @var DataInstaller $dataInstaller */ | ||
$dataInstaller = $this->dataInstallerFactory->create(); | ||
$dataInstaller->addCountryRegions( | ||
$this->moduleDataSetup->getConnection(), | ||
$this->getDataForBelgium() | ||
); | ||
} | ||
|
||
/** | ||
* Belgium states data. | ||
* | ||
* @return array | ||
*/ | ||
private function getDataForBelgium() | ||
{ | ||
return [ | ||
['BE', 'VAN', 'Antwerpen'], | ||
['BE', 'WBR', 'Brabant wallon'], | ||
['BE', 'BRU', 'Brussels Hoofdstedelijk Gewest'], | ||
['BE', 'WHT', 'Hainaut'], | ||
['BE', 'VLI', 'Limburg'], | ||
['BE', 'WLG', 'Liege'], | ||
['BE', 'WLX', 'Luxembourg'], | ||
['BE', 'WNA', 'Namur'], | ||
['BE', 'VOV', 'Oost-Vlaanderen'], | ||
['BE', 'VLG', 'Vlaams Gewest'], | ||
['BE', 'VBR', 'Vlaams-Brabant'], | ||
['BE', 'VWV', 'West-Vlaanderen'], | ||
['BE', 'WAL', 'Wallonne, Region'] | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function getDependencies() | ||
{ | ||
return [ | ||
InitializeDirectoryData::class, | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getAliases() | ||
{ | ||
return []; | ||
} | ||
} |
Oops, something went wrong.