diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0cbcdda7e..0e92d3e71 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,14 @@
+2.1.7
+=============
+* Added support for versions:
+
+ * Magento CE: 1.9.3.3, 2.1.7
+ * Magento EE: 1.14.3.3, 2.1.7
+
+* Fixed bugs:
+ * [Issue #283](https://github.com/magento/data-migration-tool/issues/283): Ignored attributes were not cleaned properly in the following extended attribute tables: `catalog_eav_attribute`, `customer_eav_attribute`
+ * [Issue #176](https://github.com/magento/data-migration-tool/issues/176): Ignored fields in the `map-eav.xml` file caused errors during migration if the table fields could not be NULL (set as NOT NULL)
+
2.1.6
=============
* Added possibility to specify custom port for MySQL server connection
diff --git a/composer.json b/composer.json
index 2ce94a74b..8a9f6cc9d 100644
--- a/composer.json
+++ b/composer.json
@@ -1,7 +1,7 @@
{
"name": "magento/data-migration-tool",
"description": "Migration Tool",
- "version": "2.1.6",
+ "version": "2.1.7",
"require": {
"symfony/console": "~2.3",
"magento/framework": "~100.1",
diff --git a/etc/ce-to-ce/1.9.3.3/config.xml.dist b/etc/ce-to-ce/1.9.3.3/config.xml.dist
new file mode 100644
index 000000000..ab93dd026
--- /dev/null
+++ b/etc/ce-to-ce/1.9.3.3/config.xml.dist
@@ -0,0 +1,144 @@
+
+
+
+
+
+ Migration\Step\Settings\Integrity
+ Migration\Step\Settings\Data
+
+
+ Migration\Step\Stores\Integrity
+ Migration\Step\Stores\Data
+ Migration\Step\Stores\Volume
+
+
+
+
+ Migration\Step\DataIntegrity\Integrity
+
+
+ Migration\Step\Eav\Integrity
+ Migration\Step\Eav\Data
+ Migration\Step\Eav\Volume
+
+
+ Migration\Step\Customer\Integrity
+ Migration\Step\Customer\Data
+ Migration\Step\Customer\Volume
+
+
+ Migration\Step\Map\Integrity
+ Migration\Step\Map\Data
+ Migration\Step\Map\Volume
+
+
+ Migration\Step\UrlRewrite\Version191to2000
+ Migration\Step\UrlRewrite\Version191to2000
+ Migration\Step\UrlRewrite\Version191to2000
+
+
+ Migration\Step\Log\Integrity
+ Migration\Step\Log\Data
+ Migration\Step\Log\Volume
+
+
+ Migration\Step\Ratings\Integrity
+ Migration\Step\Ratings\Data
+ Migration\Step\Ratings\Volume
+
+
+ Migration\Step\ConfigurablePrices\Integrity
+ Migration\Step\ConfigurablePrices\Data
+ Migration\Step\ConfigurablePrices\Volume
+
+
+ Migration\Step\OrderGrids\Integrity
+ Migration\Step\OrderGrids\Data
+ Migration\Step\OrderGrids\Volume
+
+
+ Migration\Step\TierPrice\Integrity
+ Migration\Step\TierPrice\Data
+ Migration\Step\TierPrice\Volume
+
+
+ Migration\Step\SalesIncrement\Integrity
+ Migration\Step\SalesIncrement\Data
+ Migration\Step\SalesIncrement\Volume
+
+
+ Migration\Step\PostProcessing\Data
+
+
+
+
+ Migration\Step\Customer\Delta
+ Migration\Step\Customer\Volume
+
+
+ Migration\Step\Map\Delta
+ Migration\Step\Map\Volume
+
+
+ Migration\Step\Log\Delta
+ Migration\Step\Log\Volume
+
+
+ Migration\Step\OrderGrids\Delta
+ Migration\Step\OrderGrids\Volume
+
+
+ Migration\Step\SalesIncrement\Delta
+ Migration\Step\SalesIncrement\Volume
+
+
+
+
+
+
+
+ etc/ce-to-ce/1.9.3.3/map.xml.dist
+ etc/ce-to-ce/map-eav.xml.dist
+ etc/ce-to-ce/eav-document-groups.xml.dist
+ etc/ce-to-ce/eav-attribute-groups.xml.dist
+ etc/ce-to-ce/map-log.xml.dist
+ etc/ce-to-ce/log-document-groups.xml.dist
+ etc/ce-to-ce/settings.xml.dist
+ etc/ce-to-ce/map-customer.xml.dist
+ etc/ce-to-ce/customer-document-groups.xml.dist
+ etc/ce-to-ce/customer-attribute-groups.xml.dist
+ etc/ce-to-ce/deltalog.xml.dist
+ etc/ce-to-ce/order-grids-document-groups.xml.dist
+ etc/ce-to-ce/map-document-groups.xml.dist
+ etc/ce-to-ce/class-map.xml.dist
+ etc/ce-to-ce/1.9.3.3/map-tier-price.xml.dist
+
+ 0
+
+ 0
+
+
+ 0
+ migration.log
+ %percent%% [%bar%] Remaining Time: %remaining%
+ 1
+ ce-to-ce
+ 1.9.3.3
+ SET NAMES utf8;
+ SET NAMES utf8;
+
+
+
diff --git a/etc/ce-to-ce/1.9.3.3/map-tier-price.xml.dist b/etc/ce-to-ce/1.9.3.3/map-tier-price.xml.dist
new file mode 100644
index 000000000..153f530de
--- /dev/null
+++ b/etc/ce-to-ce/1.9.3.3/map-tier-price.xml.dist
@@ -0,0 +1,17 @@
+
+
+
diff --git a/etc/ce-to-ce/1.9.3.3/map.xml.dist b/etc/ce-to-ce/1.9.3.3/map.xml.dist
new file mode 100644
index 000000000..6da515682
--- /dev/null
+++ b/etc/ce-to-ce/1.9.3.3/map.xml.dist
@@ -0,0 +1,1777 @@
+
+
+
diff --git a/etc/ce-to-ee/1.9.3.3/config.xml.dist b/etc/ce-to-ee/1.9.3.3/config.xml.dist
new file mode 100644
index 000000000..70e2d3770
--- /dev/null
+++ b/etc/ce-to-ee/1.9.3.3/config.xml.dist
@@ -0,0 +1,144 @@
+
+
+
+
+
+ Migration\Step\Settings\Integrity
+ Migration\Step\Settings\Data
+
+
+ Migration\Step\Stores\Integrity
+ Migration\Step\Stores\Data
+ Migration\Step\Stores\Volume
+
+
+
+
+ Migration\Step\DataIntegrity\Integrity
+
+
+ Migration\Step\Eav\Integrity
+ Migration\Step\Eav\Data
+ Migration\Step\Eav\Volume
+
+
+ Migration\Step\Customer\Integrity
+ Migration\Step\Customer\Data
+ Migration\Step\Customer\Volume
+
+
+ Migration\Step\Map\Integrity
+ Migration\Step\Map\Data
+ Migration\Step\Map\Volume
+
+
+ Migration\Step\UrlRewrite\Version191to2000
+ Migration\Step\UrlRewrite\Version191to2000
+ Migration\Step\UrlRewrite\Version191to2000
+
+
+ Migration\Step\Log\Integrity
+ Migration\Step\Log\Data
+ Migration\Step\Log\Volume
+
+
+ Migration\Step\Ratings\Integrity
+ Migration\Step\Ratings\Data
+ Migration\Step\Ratings\Volume
+
+
+ Migration\Step\ConfigurablePrices\Integrity
+ Migration\Step\ConfigurablePrices\Data
+ Migration\Step\ConfigurablePrices\Volume
+
+
+ Migration\Step\OrderGrids\Integrity
+ Migration\Step\OrderGrids\Data
+ Migration\Step\OrderGrids\Volume
+
+
+ Migration\Step\TierPrice\Integrity
+ Migration\Step\TierPrice\Data
+ Migration\Step\TierPrice\Volume
+
+
+ Migration\Step\SalesIncrement\Integrity
+ Migration\Step\SalesIncrement\Data
+ Migration\Step\SalesIncrement\Volume
+
+
+ Migration\Step\PostProcessing\Data
+
+
+
+
+ Migration\Step\Customer\Delta
+ Migration\Step\Customer\Volume
+
+
+ Migration\Step\Map\Delta
+ Migration\Step\Map\Volume
+
+
+ Migration\Step\Log\Delta
+ Migration\Step\Log\Volume
+
+
+ Migration\Step\OrderGrids\Delta
+ Migration\Step\OrderGrids\Volume
+
+
+ Migration\Step\SalesIncrement\Delta
+ Migration\Step\SalesIncrement\Volume
+
+
+
+
+
+
+
+ etc/ce-to-ee/1.9.3.3/map.xml.dist
+ etc/ce-to-ee/map-eav.xml.dist
+ etc/ce-to-ee/eav-document-groups.xml.dist
+ etc/ce-to-ee/eav-attribute-groups.xml.dist
+ etc/ce-to-ee/map-log.xml.dist
+ etc/ce-to-ee/log-document-groups.xml.dist
+ etc/ce-to-ee/settings.xml.dist
+ etc/ce-to-ee/map-customer.xml.dist
+ etc/ce-to-ee/customer-document-groups.xml.dist
+ etc/ce-to-ee/customer-attribute-groups.xml.dist
+ etc/ce-to-ee/deltalog.xml.dist
+ etc/ce-to-ee/order-grids-document-groups.xml.dist
+ etc/ce-to-ee/map-document-groups.xml.dist
+ etc/ce-to-ee/class-map.xml.dist
+ etc/ce-to-ee/1.9.3.3/map-tier-price.xml.dist
+
+ 0
+
+ 0
+
+
+ 0
+ migration.log
+ %percent%% [%bar%] Remaining Time: %remaining%
+ 1
+ ce-to-ee
+ 1.9.3.3
+ SET NAMES utf8;
+ SET NAMES utf8;
+
+
+
diff --git a/etc/ce-to-ee/1.9.3.3/map-tier-price.xml.dist b/etc/ce-to-ee/1.9.3.3/map-tier-price.xml.dist
new file mode 100644
index 000000000..db03f1ff0
--- /dev/null
+++ b/etc/ce-to-ee/1.9.3.3/map-tier-price.xml.dist
@@ -0,0 +1,25 @@
+
+
+
diff --git a/etc/ce-to-ee/1.9.3.3/map.xml.dist b/etc/ce-to-ee/1.9.3.3/map.xml.dist
new file mode 100644
index 000000000..633f0f0c0
--- /dev/null
+++ b/etc/ce-to-ee/1.9.3.3/map.xml.dist
@@ -0,0 +1,2873 @@
+
+
+
diff --git a/etc/ee-to-ee/1.14.3.3/config.xml.dist b/etc/ee-to-ee/1.14.3.3/config.xml.dist
new file mode 100644
index 000000000..87eac3264
--- /dev/null
+++ b/etc/ee-to-ee/1.14.3.3/config.xml.dist
@@ -0,0 +1,172 @@
+
+
+
+
+
+ Migration\Step\Settings\Integrity
+ Migration\Step\Settings\Data
+
+
+ Migration\Step\Stores\Integrity
+ Migration\Step\Stores\Data
+ Migration\Step\Stores\Volume
+
+
+
+
+ Migration\Step\DataIntegrity\Integrity
+
+
+ Migration\Step\Eav\Integrity
+ Migration\Step\Eav\Data
+ Migration\Step\Eav\Volume
+
+
+ Migration\Step\CustomCustomerAttributes\Integrity
+ Migration\Step\CustomCustomerAttributes\Data
+ Migration\Step\CustomCustomerAttributes\Volume
+
+
+ Migration\Step\Customer\Integrity
+ Migration\Step\Customer\Data
+ Migration\Step\Customer\Volume
+
+
+ Migration\Step\Map\Integrity
+ Migration\Step\Map\Data
+ Migration\Step\Map\Volume
+
+
+ Migration\Step\UrlRewrite\Version11410to2000
+ Migration\Step\UrlRewrite\Version11410to2000
+ Migration\Step\UrlRewrite\Version11410to2000
+
+
+ Migration\Step\Log\Integrity
+ Migration\Step\Log\Data
+ Migration\Step\Log\Volume
+
+
+ Migration\Step\Ratings\Integrity
+ Migration\Step\Ratings\Data
+ Migration\Step\Ratings\Volume
+
+
+ Migration\Step\SalesOrder\Integrity
+ Migration\Step\SalesOrder\Data
+ Migration\Step\SalesOrder\Volume
+
+
+ Migration\Step\ConfigurablePrices\Integrity
+ Migration\Step\ConfigurablePrices\Data
+ Migration\Step\ConfigurablePrices\Volume
+
+
+ Migration\Step\OrderGridsEE\Integrity
+ Migration\Step\OrderGridsEE\Data
+ Migration\Step\OrderGridsEE\Volume
+
+
+ Migration\Step\TierPrice\Integrity
+ Migration\Step\TierPrice\Data
+ Migration\Step\TierPrice\Volume
+
+
+ Migration\Step\SalesIncrement\Integrity
+ Migration\Step\SalesIncrement\Data
+ Migration\Step\SalesIncrement\Volume
+
+
+ Migration\Step\VisualMerchandiser\Integrity
+ Migration\Step\VisualMerchandiser\Data
+ Migration\Step\VisualMerchandiser\Volume
+
+
+ Migration\Step\PostProcessing\Data
+
+
+
+
+ Migration\Step\CustomCustomerAttributes\Delta
+ Migration\Step\CustomCustomerAttributes\Volume
+
+
+ Migration\Step\Customer\Delta
+ Migration\Step\Customer\Volume
+
+
+ Migration\Step\Map\Delta
+
+
+ Migration\Step\Log\Delta
+ Migration\Step\Log\Volume
+
+
+ Migration\Step\SalesOrder\Delta
+ Migration\Step\SalesOrder\Volume
+
+
+ Migration\Step\OrderGridsEE\Delta
+ Migration\Step\OrderGridsEE\Volume
+
+
+ Migration\Step\SalesIncrement\Delta
+ Migration\Step\SalesIncrement\Volume
+
+
+
+
+
+
+
+ etc/ee-to-ee/1.14.3.3/map.xml.dist
+ etc/ee-to-ee/map-eav.xml.dist
+ etc/ee-to-ee/eav-document-groups.xml.dist
+ etc/ee-to-ee/eav-attribute-groups.xml.dist
+ etc/ee-to-ee/map-log.xml.dist
+ etc/ee-to-ee/log-document-groups.xml.dist
+ etc/ee-to-ee/settings.xml.dist
+ etc/ee-to-ee/map-customer.xml.dist
+ etc/ee-to-ee/customer-document-groups.xml.dist
+ etc/ee-to-ee/customer-attribute-groups.xml.dist
+ etc/ee-to-ee/map-sales.xml.dist
+ etc/ee-to-ee/deltalog.xml.dist
+ etc/ee-to-ee/customer-attr-map.xml.dist
+ etc/ee-to-ee/customer-attr-document-groups.xml.dist
+ etc/ee-to-ee/order-grids-document-groups.xml.dist
+ etc/ee-to-ee/class-map.xml.dist
+ etc/ee-to-ee/visual_merchandiser_map.xml.dist
+ etc/ee-to-ee/visual_merchandiser_document_groups.xml.dist
+ etc/ee-to-ee/visual_merchandiser_attribute_groups.xml.dist
+ etc/ee-to-ee/map-document-groups.xml.dist
+ etc/ee-to-ee/1.14.3.3/map-tier-price.xml.dist
+
+ 0
+
+ 0
+
+
+ 0
+ migration.log
+ %percent%% [%bar%] Remaining Time: %remaining%
+ 1
+ ee-to-ee
+ 1.14.3.3
+ SET NAMES utf8;
+ SET NAMES utf8;
+
+
+
diff --git a/etc/ee-to-ee/1.14.3.3/map-tier-price.xml.dist b/etc/ee-to-ee/1.14.3.3/map-tier-price.xml.dist
new file mode 100644
index 000000000..db03f1ff0
--- /dev/null
+++ b/etc/ee-to-ee/1.14.3.3/map-tier-price.xml.dist
@@ -0,0 +1,25 @@
+
+
+
diff --git a/etc/ee-to-ee/1.14.3.3/map.xml.dist b/etc/ee-to-ee/1.14.3.3/map.xml.dist
new file mode 100644
index 000000000..0f0f0768c
--- /dev/null
+++ b/etc/ee-to-ee/1.14.3.3/map.xml.dist
@@ -0,0 +1,2566 @@
+
+
+
diff --git a/src/Migration/Step/Eav/Data.php b/src/Migration/Step/Eav/Data.php
index a083e2940..4667c8199 100644
--- a/src/Migration/Step/Eav/Data.php
+++ b/src/Migration/Step/Eav/Data.php
@@ -17,6 +17,7 @@
use Migration\ResourceModel\Document;
use Migration\ResourceModel\RecordFactory;
use Migration\ResourceModel\Source;
+use Migration\Step\Eav\Model\IgnoredAttributes;
/**
* Class Data
@@ -99,6 +100,11 @@ class Data implements StageInterface, RollbackInterface
*/
protected $initialData;
+ /**
+ * @var IgnoredAttributes
+ */
+ protected $ignoredAttributes;
+
/**
* @var ProgressBar\LogLevelProcessor
*/
@@ -147,6 +153,7 @@ class Data implements StageInterface, RollbackInterface
* @param Helper $helper
* @param RecordFactory $factory
* @param InitialData $initialData
+ * @param IgnoredAttributes $ignoredAttributes
* @param ProgressBar\LogLevelProcessor $progress
*/
public function __construct(
@@ -157,6 +164,7 @@ public function __construct(
Helper $helper,
RecordFactory $factory,
InitialData $initialData,
+ IgnoredAttributes $ignoredAttributes,
ProgressBar\LogLevelProcessor $progress
) {
$this->source = $source;
@@ -166,6 +174,7 @@ public function __construct(
$this->helper = $helper;
$this->factory = $factory;
$this->initialData = $initialData;
+ $this->ignoredAttributes = $ignoredAttributes;
$this->progress = $progress;
}
@@ -176,7 +185,6 @@ public function __construct(
public function perform()
{
$this->progress->start($this->getIterationsCount());
- $this->initialData->init();
$this->migrateEntityTypes();
$this->migrateAttributeSetsAndGroups();
$this->changeOldAttributeSetIdsInEntityTypes(['customer', 'customer_address']);
@@ -408,7 +416,7 @@ protected function migrateAttributes()
$this->map->getDocumentMap($sourceDocName, MapInterface::TYPE_SOURCE)
);
$this->destination->backupDocument($destinationDocument->getName());
- $sourceRecords = $this->helper->clearIgnoredAttributes($this->initialData->getAttributes('source'));
+ $sourceRecords = $this->ignoredAttributes->clearIgnoredAttributes($this->initialData->getAttributes('source'));
$destinationRecords = $this->initialData->getAttributes('dest');
$recordsToSave = $destinationDocument->getRecords();
@@ -777,7 +785,9 @@ protected function migrateAttributesExtended()
$this->destination->backupDocument($destinationDocument->getName());
$destinationRecords = $this->helper->getDestinationRecords($documentName, [$mappingField]);
$recordsToSave = $destinationDocument->getRecords();
- foreach ($this->helper->getSourceRecords($documentName) as $recordData) {
+ $sourceRecords = $this->ignoredAttributes
+ ->clearIgnoredAttributes($this->helper->getSourceRecords($documentName));
+ foreach ($sourceRecords as $recordData) {
/** @var Record $sourceRecord */
$sourceRecord = $this->factory->create(['document' => $sourceDocument, 'data' => $recordData]);
/** @var Record $destinationRecord */
diff --git a/src/Migration/Step/Eav/InitialData.php b/src/Migration/Step/Eav/InitialData.php
index 2678d97df..a57c08867 100644
--- a/src/Migration/Step/Eav/InitialData.php
+++ b/src/Migration/Step/Eav/InitialData.php
@@ -68,15 +68,6 @@ public function __construct(MapFactory $mapFactory, Source $source, Destination
$this->source = $source;
$this->destination = $destination;
$this->helper = $helper;
- }
-
- /**
- * Load EAV data before migration
- *
- * @return void
- */
- public function init()
- {
$this->initAttributeSets();
$this->initAttributeGroups();
$this->initAttributes();
diff --git a/src/Migration/Step/Eav/Integrity/AttributeFrontendInput.php b/src/Migration/Step/Eav/Integrity/AttributeFrontendInput.php
index e6d18cd40..c8a41525c 100644
--- a/src/Migration/Step/Eav/Integrity/AttributeFrontendInput.php
+++ b/src/Migration/Step/Eav/Integrity/AttributeFrontendInput.php
@@ -6,7 +6,7 @@
namespace Migration\Step\Eav\Integrity;
use Migration\Step\Eav\Helper;
-use Migration\Reader\MapInterface;
+use Migration\Step\Eav\Model\IgnoredAttributes;
/**
* Class AttributeFrontendInput
@@ -28,12 +28,19 @@ class AttributeFrontendInput
*/
private $attributeFieldName = 'frontend_input';
+ /**
+ * @var IgnoredAttributes
+ */
+ private $ignoredAttributes;
+
/**
* @param Helper $helper
+ * @param IgnoredAttributes $ignoredAttributes
*/
- public function __construct(Helper $helper)
+ public function __construct(Helper $helper, IgnoredAttributes $ignoredAttributes)
{
$this->helper = $helper;
+ $this->ignoredAttributes = $ignoredAttributes;
}
/**
@@ -44,7 +51,7 @@ public function __construct(Helper $helper)
public function checkAttributeFrontendInput()
{
$sourceAttributes = $this->helper->getSourceRecords($this->attributeDocument);
- $sourceAttributes = $this->helper->clearIgnoredAttributes($sourceAttributes);
+ $sourceAttributes = $this->ignoredAttributes->clearIgnoredAttributes($sourceAttributes);
$emptyAttributes = $this->getFrontendInputEmptyAttributes($sourceAttributes);
$incompatibleData = [];
diff --git a/src/Migration/Step/Eav/Model/IgnoredAttributes.php b/src/Migration/Step/Eav/Model/IgnoredAttributes.php
new file mode 100644
index 000000000..8c435fde4
--- /dev/null
+++ b/src/Migration/Step/Eav/Model/IgnoredAttributes.php
@@ -0,0 +1,65 @@
+helper = $helper;
+ $this->initialData = $initialData;
+ }
+
+ /**
+ * Remove ignored attributes from source records
+ *
+ * @param array $sourceRecords
+ * @return array
+ */
+ public function clearIgnoredAttributes($sourceRecords)
+ {
+ $attributesIgnoreIds = [];
+ $initialAttributes = $this->initialData->getAttributes('source');
+ $ignoredAttributes = $this->helper->getAttributesGroupCodes('ignore');
+ foreach ($ignoredAttributes as $attributeCode => $entityTypeIds) {
+ foreach ($initialAttributes as $attribute) {
+ if ($attribute['attribute_code'] == $attributeCode
+ && in_array($attribute['entity_type_id'], $entityTypeIds)
+ ) {
+ $attributesIgnoreIds[] = $attribute['attribute_id'];
+ }
+ }
+ }
+ foreach ($sourceRecords as $attrNum => $sourceAttribute) {
+ if (in_array($sourceAttribute['attribute_id'], $attributesIgnoreIds)) {
+ unset($sourceRecords[$attrNum]);
+ }
+ }
+ return $sourceRecords;
+ }
+}
diff --git a/src/Migration/Step/Eav/Volume.php b/src/Migration/Step/Eav/Volume.php
index d0fbb66ba..2b3211983 100644
--- a/src/Migration/Step/Eav/Volume.php
+++ b/src/Migration/Step/Eav/Volume.php
@@ -10,6 +10,7 @@
use Migration\App\ProgressBar;
use Migration\Reader\GroupsFactory;
use Migration\ResourceModel\Destination;
+use Migration\Step\Eav\Model\IgnoredAttributes;
/**
* Class Volume
@@ -46,6 +47,11 @@ class Volume extends AbstractVolume
*/
protected $tableKeys;
+ /**
+ * @var IgnoredAttributes
+ */
+ protected $ignoredAttributes;
+
/**
* Eav Attributes that can be validated
* @var array
@@ -74,6 +80,7 @@ class Volume extends AbstractVolume
/**
* @param Helper $helper
* @param InitialData $initialData
+ * @param IgnoredAttributes $ignoredAttributes
* @param Logger $logger
* @param ProgressBar\LogLevelProcessor $progress
* @param GroupsFactory $groupsFactory
@@ -82,12 +89,14 @@ class Volume extends AbstractVolume
public function __construct(
Helper $helper,
InitialData $initialData,
+ IgnoredAttributes $ignoredAttributes,
Logger $logger,
ProgressBar\LogLevelProcessor $progress,
GroupsFactory $groupsFactory,
Destination $destination
) {
$this->initialData = $initialData;
+ $this->ignoredAttributes = $ignoredAttributes;
$this->helper = $helper;
$this->progress = $progress;
$this->groups = $groupsFactory->create('eav_document_groups_file');
@@ -178,7 +187,8 @@ protected function validateCustomConditions(array $attribute, array $conditions)
*/
protected function checkAttributesMismatch($attribute)
{
- $sourceAttributes = $this->helper->clearIgnoredAttributes($this->initialData->getAttributes('source'));
+ $sourceAttributes = $this->ignoredAttributes
+ ->clearIgnoredAttributes($this->initialData->getAttributes('source'));
if (isset($sourceAttributes[$attribute['attribute_id']])
&& ($sourceAttributes[$attribute['attribute_id']]['attribute_code'] != $attribute['attribute_code'])
diff --git a/tests/integration/testsuite/Migration/Step/EAV/VolumeTest.php b/tests/integration/testsuite/Migration/Step/EAV/VolumeTest.php
index 1612fb2f8..823124bac 100644
--- a/tests/integration/testsuite/Migration/Step/EAV/VolumeTest.php
+++ b/tests/integration/testsuite/Migration/Step/EAV/VolumeTest.php
@@ -29,6 +29,7 @@ public function setUp()
$objectManager = \Migration\TestFramework\Helper::getInstance()->getObjectManager();
$objectManager->get('\Migration\Config')->init(dirname(__DIR__) . '/../_files/config.xml');
$initialData = $objectManager->get('Migration\Step\Eav\InitialData');
+ $ignoredAttributes = $objectManager->get('Migration\Step\Eav\Model\IgnoredAttributes');
$this->data = $objectManager->create(
'Migration\Step\Eav\Data',
[
@@ -39,6 +40,7 @@ public function setUp()
'Migration\Step\Eav\Volume',
[
'initialData' => $initialData,
+ 'ignoredAttributes' => $ignoredAttributes
]
);
}
diff --git a/tests/unit/testsuite/Migration/Step/Eav/InitialDataTest.php b/tests/unit/testsuite/Migration/Step/Eav/InitialDataTest.php
index a7f14b4f8..583a3c738 100644
--- a/tests/unit/testsuite/Migration/Step/Eav/InitialDataTest.php
+++ b/tests/unit/testsuite/Migration/Step/Eav/InitialDataTest.php
@@ -57,25 +57,8 @@ public function setUp()
$this->helper = $this->getMockBuilder('\Migration\Step\Eav\Helper')->disableOriginalConstructor()
->setMethods(['getSourceRecords', 'getDestinationRecords'])
->getMock();
- $this->initialData = new InitialData($mapFactory, $this->source, $this->destination, $this->helper);
- }
- /**
- * @covers \Migration\Step\Eav\InitialData::Init
- * @covers \Migration\Step\Eav\InitialData::initAttributes
- * @covers \Migration\Step\Eav\InitialData::initAttributeSets
- * @covers \Migration\Step\Eav\InitialData::initAttributeGroups
- * @covers \Migration\Step\Eav\InitialData::getAttributes
- * @covers \Migration\Step\Eav\InitialData::getAttributeSets
- * @covers \Migration\Step\Eav\InitialData::getAttributeGroups
- * @return void
- */
- public function testInit()
- {
- $dataAttributes = [
- 'source' => ['id_1' => 'value_1','id_2' => 'value_2'],
- 'dest' => ['id_1' => 'value_1','id_2' => 'value_2']
- ];
+ $dataAttributes = $this->getDataAttributes();
$eavEntityTypes = [
'source' => [
['entity_type_id' => '1', 'entity_type_code' => 'customer'],
@@ -101,10 +84,6 @@ public function testInit()
['eav_attribute', ['attribute_id'], $dataAttributes['source']],
['eav_entity_type', [], $eavEntityTypes['source']]
]);
- $this->helper->expects($this->any())->method('clearIgnored')->willReturnMap([
- [$dataAttributes['source'], $dataAttributes['source']],
- [$eavEntityTypes['source'], $eavEntityTypes['source']]
- ]);
$this->helper->expects($this->any())->method('getDestinationRecords')->willReturnMap(
[
['eav_attribute', ['entity_type_id', 'attribute_code'], $dataAttributes['dest']],
@@ -113,11 +92,47 @@ public function testInit()
['eav_entity_type', [], $eavEntityTypes['dest']]
]
);
- $this->initialData->init();
+
+ $this->initialData = new InitialData($mapFactory, $this->source, $this->destination, $this->helper);
+ }
+
+ /**
+ * @return void
+ */
+ public function testAttributes()
+ {
+ $dataAttributes = $this->getDataAttributes();
foreach ($dataAttributes as $resourceType => $resourceData) {
$this->assertEquals($resourceData, $this->initialData->getAttributes($resourceType));
}
+ }
+
+ /**
+ * @return void
+ */
+ public function testAttributeSets()
+ {
+ $attributeSets = ['attr_set_1', 'attr_set_2'];
$this->assertEquals($attributeSets, $this->initialData->getAttributeSets('dest'));
+ }
+
+ /**
+ * @return void
+ */
+ public function testAttributeGroups()
+ {
+ $attributeGroups = ['attr_group_1', 'attr_group_2'];
$this->assertEquals($attributeGroups, $this->initialData->getAttributeGroups('dest'));
}
+
+ /**
+ * @return array
+ */
+ private function getDataAttributes()
+ {
+ return [
+ 'source' => ['id_1' => 'value_1','id_2' => 'value_2'],
+ 'dest' => ['id_1' => 'value_1','id_2' => 'value_2']
+ ];
+ }
}
diff --git a/tests/unit/testsuite/Migration/Step/Eav/Integrity/AttributeFrontendInputTest.php b/tests/unit/testsuite/Migration/Step/Eav/Integrity/AttributeFrontendInputTest.php
index b68257c99..0a42af61c 100644
--- a/tests/unit/testsuite/Migration/Step/Eav/Integrity/AttributeFrontendInputTest.php
+++ b/tests/unit/testsuite/Migration/Step/Eav/Integrity/AttributeFrontendInputTest.php
@@ -7,6 +7,7 @@
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Migration\Step\Eav\Helper;
+use Migration\Step\Eav\Model\IgnoredAttributes;
/**
* Class AttributeFrontendInputTest
@@ -23,6 +24,11 @@ class AttributeFrontendInputTest extends \PHPUnit_Framework_TestCase
*/
protected $helper;
+ /**
+ * @var IgnoredAttributes|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private $ignoredAttributes;
+
/**
* @return void
*/
@@ -32,10 +38,15 @@ protected function setUp()
->disableOriginalConstructor()
->setMethods(['getSourceRecords', 'getAttributesGroupCodes'])
->getMock();
+ $this->ignoredAttributes = $this->getMockBuilder(IgnoredAttributes::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['clearIgnoredAttributes'])
+ ->getMock();
$objectHelper = new ObjectManager($this);
$this->model = $objectHelper->getObject(AttributeFrontendInput::class, [
- 'helper' => $this->helper
+ 'helper' => $this->helper,
+ 'ignoredAttributes' => $this->ignoredAttributes
]);
}
@@ -47,49 +58,55 @@ protected function setUp()
*/
public function testCheckAttributeGroupNames($groupCodes, $errorsCount)
{
+ $sourceRecords = [
+ [
+ 'attribute_id' => '60',
+ 'entity_type_id' => '4',
+ 'attribute_code' => 'name',
+ 'frontend_input' => 'text'
+ ], [
+ 'attribute_id' => '61',
+ 'entity_type_id' => '4',
+ 'attribute_code' => 'description',
+ 'frontend_input' => 'textarea'
+ ], [
+ 'attribute_id' => '63',
+ 'entity_type_id' => '4',
+ 'attribute_code' => 'sku',
+ 'frontend_input' => 'text'
+ ], [
+ 'attribute_id' => '169',
+ 'entity_type_id' => '4',
+ 'attribute_code' => 'group_price',
+ 'frontend_input' => null
+ ],
+ [
+ 'attribute_id' => '70',
+ 'entity_type_id' => '4',
+ 'attribute_code' => 'manufacturer',
+ 'frontend_input' => 'select'
+ ], [
+ 'attribute_id' => '84',
+ 'entity_type_id' => '4',
+ 'attribute_code' => 'status',
+ 'frontend_input' => 'select'
+ ],
+ [
+ 'attribute_id' => '143',
+ 'entity_type_id' => '4',
+ 'attribute_code' => 'msrp_enabled',
+ 'frontend_input' => ''
+ ],
+ ];
$this->helper
->expects($this->any())
->method('getSourceRecords')
- ->willReturn([
- [
- 'attribute_id' => '60',
- 'entity_type_id' => '4',
- 'attribute_code' => 'name',
- 'frontend_input' => 'text'
- ], [
- 'attribute_id' => '61',
- 'entity_type_id' => '4',
- 'attribute_code' => 'description',
- 'frontend_input' => 'textarea'
- ], [
- 'attribute_id' => '63',
- 'entity_type_id' => '4',
- 'attribute_code' => 'sku',
- 'frontend_input' => 'text'
- ], [
- 'attribute_id' => '169',
- 'entity_type_id' => '4',
- 'attribute_code' => 'group_price',
- 'frontend_input' => null
- ],
- [
- 'attribute_id' => '70',
- 'entity_type_id' => '4',
- 'attribute_code' => 'manufacturer',
- 'frontend_input' => 'select'
- ], [
- 'attribute_id' => '84',
- 'entity_type_id' => '4',
- 'attribute_code' => 'status',
- 'frontend_input' => 'select'
- ],
- [
- 'attribute_id' => '143',
- 'entity_type_id' => '4',
- 'attribute_code' => 'msrp_enabled',
- 'frontend_input' => ''
- ],
- ]);
+ ->willReturn($sourceRecords);
+ $this->ignoredAttributes
+ ->expects($this->any())
+ ->method('clearIgnoredAttributes')
+ ->with($sourceRecords)
+ ->willReturn($sourceRecords);
$this->helper->expects($this->any())->method('getAttributesGroupCodes')->willReturnMap($groupCodes);
$this->assertCount($errorsCount, $this->model->checkAttributeFrontendInput());
@@ -103,25 +120,21 @@ public function getFixtureData()
return [
[
[
- ['ignore', ['msrp_enabled' => ['4']]],
['frontend_input_empty_allowed', ['group_price' => ['4']]]
],
- 0
+ 1
], [
[
- ['ignore', ['group_price' => ['4']]],
['frontend_input_empty_allowed', ['msrp_enabled' => ['4']]]
],
- 0
+ 1
],[
[
- ['ignore', []],
['frontend_input_empty_allowed', []]
],
2
],[
[
- ['ignore', ['msrp_enabled' => ['10']]],
['frontend_input_empty_allowed', ['group_price' => ['10']]]
],
2
diff --git a/tests/unit/testsuite/Migration/Step/Eav/Model/IgnoredAttributesTest.php b/tests/unit/testsuite/Migration/Step/Eav/Model/IgnoredAttributesTest.php
new file mode 100644
index 000000000..ff9b95647
--- /dev/null
+++ b/tests/unit/testsuite/Migration/Step/Eav/Model/IgnoredAttributesTest.php
@@ -0,0 +1,86 @@
+helper = $this->getMockBuilder(\Migration\Step\Eav\Helper::class)->disableOriginalConstructor()
+ ->setMethods(['getAttributesGroupCodes'])
+ ->getMock();
+ $this->initialData = $this->getMockBuilder(\Migration\Step\Eav\InitialData::class)->disableOriginalConstructor()
+ ->setMethods(['getAttributes'])
+ ->getMock();
+ $this->ignoredAttributes = new IgnoredAttributes($this->helper, $this->initialData);
+ }
+
+ /**
+ * @return void
+ */
+ public function testClearIgnoredAttributes()
+ {
+ $allSourceRecords = [
+ 0 => [
+ 'attribute_code' => 'attribute_code_3_ignored',
+ 'entity_type_id' => 111,
+ 'attribute_id' => 54,
+ ],
+ 1 => [
+ 'attribute_code' => 'attribute_code_1',
+ 'entity_type_id' => 1,
+ 'attribute_id' => 55,
+ ],
+ 2 => [
+ 'attribute_code' => 'attribute_code_2',
+ 'entity_type_id' => 2,
+ 'attribute_id' => 56,
+ ]
+ ];
+ $ignoredSourceRecords = ['attribute_code_3_ignored' => [111]];
+ $clearedSourceRecords = [
+ 1 => [
+ 'attribute_code' => 'attribute_code_1',
+ 'entity_type_id' => 1,
+ 'attribute_id' => 55,
+ ],
+ 2 => [
+ 'attribute_code' => 'attribute_code_2',
+ 'entity_type_id' => 2,
+ 'attribute_id' => 56,
+ ]
+ ];
+ $this->initialData->expects($this->once())->method('getAttributes')->with('source')
+ ->willReturn($allSourceRecords);
+ $this->helper->expects($this->once())->method('getAttributesGroupCodes')->with('ignore')
+ ->willReturn($ignoredSourceRecords);
+ $this->assertEquals($clearedSourceRecords, $this->ignoredAttributes->clearIgnoredAttributes($allSourceRecords));
+ }
+}
diff --git a/tests/unit/testsuite/Migration/Step/Eav/VolumeTest.php b/tests/unit/testsuite/Migration/Step/Eav/VolumeTest.php
index 6bf7961f7..4a5e3b5c6 100644
--- a/tests/unit/testsuite/Migration/Step/Eav/VolumeTest.php
+++ b/tests/unit/testsuite/Migration/Step/Eav/VolumeTest.php
@@ -20,6 +20,11 @@ class VolumeTest extends \PHPUnit_Framework_TestCase
*/
protected $initialData;
+ /**
+ * @var \Migration\Step\Eav\Model\IgnoredAttributes|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private $ignoredAttributes;
+
/**
* @var \Migration\Logger\Logger|\PHPUnit_Framework_MockObject_MockObject
*/
@@ -59,8 +64,7 @@ public function setUp()
'getDestinationRecords',
'getSourceRecordsCount',
'getDestinationRecordsCount',
- 'deleteBackups',
- 'clearIgnoredAttributes'
+ 'deleteBackups'
]
)->getMock();
$this->logger = $this->getMockBuilder('\Migration\Logger\Logger')->disableOriginalConstructor()
@@ -87,10 +91,15 @@ public function setUp()
->disableOriginalConstructor()
->setMethods(['getDocument'])
->getMock();
+ $this->ignoredAttributes = $this->getMockBuilder(\Migration\Step\Eav\Model\IgnoredAttributes::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['clearIgnoredAttributes'])
+ ->getMock();
$this->volume = new Volume(
$this->helper,
$this->initialData,
+ $this->ignoredAttributes,
$this->logger,
$this->progress,
$groupsFactory,
@@ -154,7 +163,7 @@ public function testPerform()
$this->initialData->expects($this->once())->method('getAttributeGroups')->willReturn(1);
$this->helper->expects($this->any())->method('getDestinationRecordsCount')->willReturn(2);
$this->helper->expects($this->once())->method('deleteBackups');
- $this->helper->expects($this->any())->method('clearIgnoredAttributes')->with($eavAttributes)
+ $this->ignoredAttributes->expects($this->any())->method('clearIgnoredAttributes')->with($eavAttributes)
->willReturn($eavAttributes);
$this->logger->expects($this->never())->method('addRecord');