/**
  * Returns document object
  *
  * @param string $documentName
  * @return \Migration\ResourceModel\Document|false
  */
 public function getDocument($documentName)
 {
     $documentList = $this->getDocumentList();
     if (!in_array($documentName, $documentList)) {
         return false;
     }
     $structure = $this->getStructure($documentName);
     return $this->documentFactory->create(['structure' => $structure, 'documentName' => $documentName]);
 }
 /**
  * @dataProvider getDocumentDataSource()
  * @param string $prefix
  * @param string $optionName
  * @return void
  */
 public function testGetDocument($prefix, $optionName)
 {
     $resourceName = 'core_config_data';
     $structureData = ['id' => 'int'];
     $structure = $this->getMock('\\Migration\\ResourceModel\\Structure', [], [], '', false);
     $document = $this->getMock('\\Migration\\ResourceModel\\Document', [], [], '', false);
     $this->config->expects($this->any())->method('getOption')->with($optionName)->will($this->returnValue($prefix));
     $this->documentFactory->expects($this->any())->method('create')->with($this->equalTo(['structure' => $structure, 'documentName' => $resourceName]))->will($this->returnValue($document));
     $this->adapter->expects($this->any())->method('getDocumentStructure')->with($this->equalTo($prefix . $resourceName))->willReturn($structureData);
     $this->structureFactory->expects($this->any())->method('create')->with($this->equalTo(['documentName' => $resourceName, 'data' => $structureData]))->willReturn($structure);
     $this->adapter->expects($this->any())->method('getDocumentList')->willReturn([$prefix . $resourceName]);
     $resource = $prefix == MapInterface::TYPE_SOURCE ? $this->resourceSource : $this->resourceDestination;
     $this->assertSame($document, $resource->getDocument($resourceName));
 }