/**
  * @return void
  */
 public function testGetSourceAttributes()
 {
     $entity = [0 => ['entity_id' => 1, 'value' => 'entity_value']];
     $mySqlAdapter = $this->getMock('\\Migration\\ResourceModel\\Adapter\\Mysql', ['getSelect', 'loadDataFromSelect'], [], '', false);
     $dbSelect = $this->getMock('\\Magento\\Framework\\DB\\Select', ['from', 'where'], [], '', false);
     $mySqlAdapter->expects($this->any())->method('getSelect')->willReturn($dbSelect);
     $this->source->expects($this->any())->method('getAdapter')->willReturn($mySqlAdapter);
     $this->source->expects($this->any())->method('addDocumentPrefix')->willReturnArgument(0);
     $dbSelect->expects($this->any())->method('from')->willReturnSelf();
     $dbSelect->expects($this->any())->method('where')->willReturnSelf();
     $mySqlAdapter->expects($this->once())->method('loadDataFromSelect')->willReturn($entity);
     $this->assertEquals($entity, $this->helper->getSourceAttributes('eav_attribute'));
 }
Пример #2
0
 /**
  * @return void
  */
 protected function checkEavEntities()
 {
     $countBeforeRun = $this->initialData->getDestEavAttributesCount($this->helper->getDestEavDocument());
     $countAfterRun = $this->destination->getRecordsCount($this->helper->getDestEavDocument());
     $countEavAttributes = null;
     foreach ($this->helper->getEavAttributes() as $eavAttribute) {
         $countEavAttributes += count($this->helper->getSourceAttributes($eavAttribute));
     }
     if ($countBeforeRun + $countEavAttributes != $countAfterRun) {
         $this->errors[] = sprintf('Mismatch of entities in the document: %s', $this->helper->getDestEavDocument());
     }
 }