/**
  * @param Record $from
  * @param Record $to
  * @return void
  */
 protected function copy(Record $from, Record $to)
 {
     $sourceDocumentName = $this->sourceDocument->getName();
     $data = $from->getData();
     $sourceFields = $from->getFields();
     $destinationFields = $to->getFields();
     $diff = array_diff($sourceFields, $destinationFields);
     foreach ($diff as $field) {
         if (!$this->mapReader->isFieldIgnored($sourceDocumentName, $field, MapInterface::TYPE_SOURCE)) {
             $fieldMap = $this->mapReader->getFieldMap($sourceDocumentName, $field, MapInterface::TYPE_SOURCE);
             $data[$fieldMap] = $from->getValue($field);
         }
         unset($data[$field]);
     }
     $to->setData($data);
 }
 /**
  * @expectedException \Migration\Exception
  * @expectedExceptionMessage Record structure does not match provided Data
  */
 public function testSetDataWithException()
 {
     $this->structure->expects($this->any())->method('getFields')->willReturn(['id', 'name']);
     $this->record->setStructure($this->structure);
     $this->record->setData(['id' => 11, 'wrongName' => 'item2']);
 }