public function testPerformJustCopy() { $sourceDocName = 'core_config_data'; $this->source->expects($this->any())->method('getDocumentList')->will($this->returnValue([$sourceDocName])); $this->source->expects($this->any())->method('getRecordsCount')->will($this->returnValue(2)); $dstDocName = 'config_data'; $this->progress->expects($this->once())->method('getProcessedEntities')->will($this->returnValue([])); $this->map->expects($this->once())->method('getDocumentMap')->will($this->returnValue($dstDocName)); $this->map->expects($this->any())->method('getHandlerConfig')->willReturn([]); $sourceDocument = $this->getMock('\\Migration\\Resource\\Document', ['getRecords', 'getStructure'], [], '', false); $bulk = [['id' => 4, 'name' => 'john']]; $this->source->expects($this->at(4))->method('getRecords')->will($this->returnValue($bulk)); $this->source->expects($this->at(5))->method('getRecords')->will($this->returnValue([])); $this->source->expects($this->once())->method('getDocument')->willReturn($sourceDocument); $destinationDocument = $this->getMockBuilder('\\Migration\\Resource\\Document')->disableOriginalConstructor()->setMethods(['getStructure', 'getRecords'])->getMock(); $this->destination->expects($this->once())->method('getDocument')->will($this->returnValue($destinationDocument)); $structure = $this->getMockBuilder('\\Migration\\Resource\\Structure')->disableOriginalConstructor()->setMethods(['getFields'])->getMock(); $structure->expects($this->any())->method('getFields')->willReturn(['field' => []]); $sourceDocument->expects($this->any())->method('getStructure')->willReturn($structure); $destinationDocument->expects($this->any())->method('getStructure')->willReturn($structure); $destinationRecords = $this->getMock('\\Migration\\Resource\\Record\\Collection', [], [], '', false); $destinationDocument->expects($this->once())->method('getRecords')->will($this->returnValue($destinationRecords)); $dstRecord = $this->getMock('\\Migration\\Resource\\Record', [], [], '', false); $this->recordFactory->expects($this->at(0))->method('create')->will($this->returnValue($dstRecord)); $this->destination->expects($this->once())->method('saveRecords')->with($dstDocName, $destinationRecords); $this->destination->expects($this->once())->method('clearDocument')->with($dstDocName); $this->data->perform(); }
/** * @param ResourceModel\Document $sourceDocument * @param ResourceModel\Document $destinationDocument * @return \Migration\RecordTransformer */ protected function getRecordTransformer($sourceDocument, $destinationDocument) { return $this->data->getRecordTransformer($sourceDocument, $destinationDocument); }