/** * @return void */ public function testHandleNotConfigurable() { $recordToHandle = $this->getMockBuilder('Migration\\ResourceModel\\Record')->setMethods(['getValue', 'setValue', 'getFields'])->disableOriginalConstructor()->getMock(); $oppositeRecord = $this->getMockBuilder('Migration\\ResourceModel\\Record')->disableOriginalConstructor()->setMethods(['getValue'])->getMock(); $oppositeRecord->expects($this->exactly(2))->method('getValue')->will($this->returnValue('simple')); $recordToHandle->expects($this->once())->method('getFields')->will($this->returnValue([$this->fieldName])); $recordToHandle->expects($this->once())->method('getValue')->with($this->fieldName)->will($this->returnValue(null)); $recordToHandle->expects($this->once())->method('setValue')->with($this->fieldName, 'simple'); $this->handler->handle($recordToHandle, $oppositeRecord); }
/** * @return void */ public function testHandleGetDestination() { /** @var Record|\PHPUnit_Framework_MockObject_MockObject $recordToHandle */ $recordToHandle = $this->getMockBuilder('Migration\\ResourceModel\\Record')->setMethods(['getValue', 'setValue', 'getFields'])->disableOriginalConstructor()->getMock(); /** @var Record|\PHPUnit_Framework_MockObject_MockObject $oppositeRecord */ $oppositeRecord = $this->getMockBuilder('Migration\\ResourceModel\\Record')->disableOriginalConstructor()->setMethods(['getValue'])->getMock(); $oppositeRecord->expects($this->exactly(2))->method('getValue')->will($this->returnValue('Some\\Class\\Name')); $this->classMap->expects($this->never())->method('convertClassName'); $recordToHandle->expects($this->once())->method('getFields')->will($this->returnValue([$this->fieldName])); $recordToHandle->expects($this->once())->method('getValue')->with($this->fieldName)->will($this->returnValue(null)); $recordToHandle->expects($this->once())->method('setValue')->with($this->fieldName, 'Some\\Class\\Name'); $this->handler->handle($recordToHandle, $oppositeRecord); }