diff --git a/etc/config.xsd b/etc/config.xsd
index 718e09682..4dcd11bd6 100644
--- a/etc/config.xsd
+++ b/etc/config.xsd
@@ -99,8 +99,8 @@
-
-
+
+
diff --git a/tests/unit/testsuite/Migration/ResourceModel/AbstractResourceTest.php b/tests/unit/testsuite/Migration/ResourceModel/AbstractResourceTest.php
index a9f595fd6..453497edb 100644
--- a/tests/unit/testsuite/Migration/ResourceModel/AbstractResourceTest.php
+++ b/tests/unit/testsuite/Migration/ResourceModel/AbstractResourceTest.php
@@ -248,7 +248,7 @@ public function testGetRecords()
*/
public function testGetAdapter()
{
- $this->config->expects($this->once())->method('getOption')->with('edition_migrate')->willReturn('ce-to-ee');
+ $this->config->expects($this->any())->method('getOption')->willReturnMap([['edition_migrate', 'ce-to-ee']]);
$this->assertSame($this->adapter, $this->resourceDestination->getAdapter());
}
}
diff --git a/tests/unit/testsuite/Migration/Step/Eav/HelperTest.php b/tests/unit/testsuite/Migration/Step/Eav/HelperTest.php
index 3e6c3040e..a18099a96 100644
--- a/tests/unit/testsuite/Migration/Step/Eav/HelperTest.php
+++ b/tests/unit/testsuite/Migration/Step/Eav/HelperTest.php
@@ -51,6 +51,21 @@ class HelperTest extends \PHPUnit_Framework_TestCase
*/
protected $readerAttributes;
+ /**
+ * @var \Migration\ResourceModel\Adapter\Mysql|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $adapter;
+
+ /**
+ * @var \Magento\Framework\DB\Adapter\Pdo\Mysql|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $pdoMysql;
+
+ /**
+ * @var \Magento\Framework\DB\Select|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $select;
+
/**
* @return void
*/
@@ -65,7 +80,7 @@ public function setUp()
$mapFactory->expects($this->any())->method('create')->with('eav_map_file')->willReturn($this->map);
$this->source = $this->getMockBuilder('Migration\ResourceModel\Source')->disableOriginalConstructor()
- ->setMethods(['getRecordsCount', 'getRecords'])
+ ->setMethods(['getRecordsCount', 'getRecords', 'getAdapter', 'addDocumentPrefix'])
->getMock();
$this->destination = $this->getMockBuilder('Migration\ResourceModel\Destination')->disableOriginalConstructor()
->setMethods(['getRecordsCount', 'getRecords', 'deleteDocumentBackup'])
@@ -94,6 +109,21 @@ public function setUp()
['eav_attribute_groups_file', $this->readerAttributes]
]
);
+ $this->adapter = $this->getMock(
+ 'Migration\ResourceModel\Adapter\Mysql',
+ ['getSelect'],
+ [],
+ '',
+ false
+ );
+ $this->pdoMysql = $this->getMock(
+ 'Magento\Framework\DB\Adapter\Pdo\Mysql',
+ ['fetchPairs'],
+ [],
+ '',
+ false
+ );
+ $this->select = $this->getMock('Magento\Framework\DB\Select', ['from', 'getAdapter'], [], '', false);
$this->helper = new Helper($mapFactory, $this->source, $this->destination, $this->factory, $groupsFactory);
}
@@ -234,25 +264,57 @@ public function testClearIgnoredAttributes()
{
$allSourceRecords = [
0 => [
- 'attribute_code' => 'ignored_attribute'
+ 'attribute_code' => 'ignored_attribute',
+ 'entity_type_id' => 111,
],
1 => [
- 'attribute_code' => 'attribute_1'
+ 'attribute_code' => 'attribute_1',
+ 'entity_type_id' => 1,
],
2 => [
- 'attribute_code' => 'attribute_2'
+ 'attribute_code' => 'attribute_2',
+ 'entity_type_id' => 2,
]
];
$clearedSourceRecords = [
1 => [
- 'attribute_code' => 'attribute_1'
+ 'attribute_code' => 'attribute_1',
+ 'entity_type_id' => 1,
],
2 => [
- 'attribute_code' => 'attribute_2'
+ 'attribute_code' => 'attribute_2',
+ 'entity_type_id' => 2,
]
];
+ $entityTypesCodeToId = [
+ 'ignored_attribute_type' => 111,
+ 'attribute_type_1' => 1,
+ 'attribute_type_2' => 2,
+ ];
+ $eavEntityTypeTable = 'eav_entity_type';
$this->readerAttributes->expects($this->once())->method('getGroup')->with('ignore')
- ->willReturn(['ignored_attribute' => 0]);
+ ->willReturn(['ignored_attribute' => ['ignored_attribute_type']]);
+ $this->source->expects($this->once())->method('getAdapter')->willReturn($this->adapter);
+ $this->source
+ ->expects($this->once())
+ ->method('addDocumentPrefix')
+ ->with($eavEntityTypeTable)
+ ->willReturn($eavEntityTypeTable);
+ $this->adapter->expects($this->once())->method('getSelect')->willReturn($this->select);
+ $this->select
+ ->expects($this->once())
+ ->method('from')
+ ->with($eavEntityTypeTable, ['entity_type_code', 'entity_type_id'])
+ ->will($this->returnSelf());
+ $this->select
+ ->expects($this->once())
+ ->method('getAdapter')
+ ->will($this->returnValue($this->pdoMysql));
+ $this->pdoMysql
+ ->expects($this->once())
+ ->method('fetchPairs')
+ ->with($this->select)
+ ->will($this->returnValue($entityTypesCodeToId));
$this->assertEquals($clearedSourceRecords, $this->helper->clearIgnoredAttributes($allSourceRecords));
}
}