public function testConvertCorrectlyConvertsConfigStructureToArray() { $testDom = dirname(dirname(__DIR__)) . '/_files/system_2.xml'; $dom = new \DOMDocument(); $dom->load($testDom); $expectedArray = (include dirname(dirname(__DIR__)) . '/_files/converted_config.php'); $this->assertEquals($expectedArray, $this->_model->convert($dom)); }
/** * Test the successful execution of the 'read' method * * @return void */ public function testReadSuccessNotValidatedCase() { $content = '<config><item name="test1"></item><item name="test2"></item></config>'; $expectedResult = ['result_data']; $fileList = ['file' => $content]; $this->fileResolverMock->expects($this->once())->method('get')->with('system.xml', 'global')->willReturn($fileList); $this->compilerMock->expects($this->once())->method('compile')->with($this->isInstanceOf('\\DOMElement'), $this->isInstanceOf('Magento\\Framework\\DataObject'), $this->isInstanceOf('Magento\\Framework\\DataObject')); $this->converterMock->expects($this->once())->method('convert')->with($this->isInstanceOf('\\DOMDocument'))->willReturn($expectedResult); $this->assertEquals($expectedResult, $this->reader->read()); }
/** * {@inheritdoc} */ public function convert($source) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'convert'); if (!$pluginInfo) { return parent::convert($source); } else { return $this->___callPlugins('convert', func_get_args(), $pluginInfo); } }