Skip to content

Commit

Permalink
MAGETWO-52161: [GitHub] Bug in EAV with group_price attribute #69
Browse files Browse the repository at this point in the history
  • Loading branch information
le0n4eg committed Aug 22, 2016
1 parent c98fcdf commit 60a1647
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Migration/Step/Eav/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ protected function migrateAttributes()
$this->map->getDocumentMap($sourceDocName, MapInterface::TYPE_SOURCE)
);
$this->destination->backupDocument($destinationDocument->getName());
$sourceRecords = $this->initialData->getAttributes('source');;
$sourceRecords = $this->helper->clearIgnored($this->initialData->getAttributes('source'));
$destinationRecords = $this->initialData->getAttributes('dest');

$recordsToSave = $destinationDocument->getRecords();
Expand Down
6 changes: 1 addition & 5 deletions src/Migration/Step/Eav/InitialData.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,7 @@ protected function initAttributes()
if ($this->attributes === null) {
$sourceDocument = 'eav_attribute';

foreach (
$this->helper->clearIgnored(
$this->helper->getSourceRecords($sourceDocument, ['attribute_id'])
) as $id => $record
) {
foreach ($this->helper->getSourceRecords($sourceDocument, ['attribute_id']) as $id => $record) {
$this->attributes['source'][$id] = $record;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Migration/Step/Eav/Volume.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ protected function validateCustomConditions(array $attribute, array $conditions)
*/
protected function checkAttributesMismatch($attribute)
{
$sourceAttributes = $this->initialData->getAttributes('source');
$sourceAttributes = $this->helper->clearIgnored($this->initialData->getAttributes('source'));

if (isset($sourceAttributes[$attribute['attribute_id']])
&& ($sourceAttributes[$attribute['attribute_id']]['attribute_code'] != $attribute['attribute_code'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function setUp()
->setMethods([])
->getMock();
$this->helper = $this->getMockBuilder('\Migration\Step\Eav\Helper')->disableOriginalConstructor()
->setMethods(['getSourceRecords', 'getDestinationRecords', 'clearIgnored'])
->setMethods(['getSourceRecords', 'getDestinationRecords'])
->getMock();
$this->initialData = new InitialData($mapFactory, $this->source, $this->destination, $this->helper);
}
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/testsuite/Migration/Step/Eav/VolumeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public function setUp()
'getDestinationRecords',
'getSourceRecordsCount',
'getDestinationRecordsCount',
'deleteBackups'
'deleteBackups',
'clearIgnored'
]
)->getMock();
$this->logger = $this->getMockBuilder('\Migration\Logger\Logger')->disableOriginalConstructor()
Expand Down Expand Up @@ -153,6 +154,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('clearIgnored')->with($eavAttributes)->willReturn($eavAttributes);
$this->logger->expects($this->never())->method('addRecord');

$documentsMap = $this->getDocumentsMap();
Expand Down

0 comments on commit 60a1647

Please sign in to comment.