35 $this->moduleReaderMock = $this->getMockBuilder(\
Magento\Framework\Module\Dir\Reader::class)
36 ->disableOriginalConstructor()
38 $this->readFactoryMock = $this->getMockBuilder(\
Magento\Framework\
Filesystem\Directory\ReadFactory::class)
39 ->disableOriginalConstructor()
42 $this->includeElement = new \Magento\Config\Model\Config\Compiler\IncludeElement(
43 $this->moduleReaderMock,
44 $this->readFactoryMock
53 $xmlContent =
'<rootConfig><include path="Module_Name::path/to/file.xml"/></rootConfig>';
55 $document = new \DOMDocument();
56 $document->loadXML($xmlContent);
58 $compilerMock = $this->getMockBuilder(\
Magento\Framework\View\TemplateEngine\Xhtml\CompilerInterface::class)
59 ->getMockForAbstractClass();
60 $processedObjectMock = $this->getMockBuilder(\
Magento\Framework\DataObject::class)
61 ->disableOriginalConstructor()
66 $compilerMock->expects($this->exactly(2))
68 ->with($this->isInstanceOf(
'\DOMElement'), $processedObjectMock, $processedObjectMock);
70 $this->includeElement->compile(
72 $document->documentElement->firstChild,
78 '<?xml version="1.0"?><rootConfig><item id="1"><test/></item><item id="2"/></rootConfig>',
79 str_replace(PHP_EOL,
'', $document->saveXML())
89 $xmlContent =
'<rootConfig><include path="Module_Name::path/to/file.xml"/></rootConfig>';
91 $document = new \DOMDocument();
92 $document->loadXML($xmlContent);
94 $compilerMock = $this->getMockBuilder(\
Magento\Framework\View\TemplateEngine\Xhtml\CompilerInterface::class)
95 ->getMockForAbstractClass();
96 $processedObjectMock = $this->getMockBuilder(\
Magento\Framework\DataObject::class)
97 ->disableOriginalConstructor()
102 $compilerMock->expects($this->never())
104 ->with($this->isInstanceOf(
'\DOMElement'), $processedObjectMock, $processedObjectMock);
106 $this->includeElement->compile(
108 $document->documentElement->firstChild,
109 $processedObjectMock,
119 $resultPath =
'adminhtml/path/to/file.xml';
120 $includeXmlContent =
'<config><item id="1"><test/></item><item id="2"></item></config>';
122 $modulesDirectoryMock = $this->getMockBuilder(\
Magento\Framework\
Filesystem\Directory\ReadInterface::class)
123 ->getMockForAbstractClass();
125 $this->readFactoryMock->expects($this->once())
127 ->willReturn($modulesDirectoryMock);
129 $this->moduleReaderMock->expects($this->once())
130 ->method(
'getModuleDir')
131 ->with(
'etc',
'Module_Name')
132 ->willReturn(
'path/in/application/module');
134 $modulesDirectoryMock->expects($this->once())
137 ->willReturn($check);
140 $modulesDirectoryMock->expects($this->once())
143 ->willReturn($check);
144 $modulesDirectoryMock->expects($this->once())
147 ->willReturn($includeXmlContent);
getContentStep($check=true)