Ejemplo n.º 1
0
 /**
  * Get configuration per file
  *
  * @return array
  */
 public function getConfiguration()
 {
     $files = $this->_fileManager->getFileList($this->_basePath . '/' . \Magento\Tools\Migration\System\Configuration\Reader::SYSTEM_CONFIG_PATH_PATTERN);
     $result = [];
     foreach ($files as $fileName) {
         $result[$fileName] = $this->_mapper->transform($this->_parser->parse($this->_getDOMDocument($this->_fileManager->getContents($fileName))));
     }
     return $result;
 }
Ejemplo n.º 2
0
    public function testParseDomNodes()
    {
        $xml = <<<XML
<?xml version="1.0"?>
<!--
/**
 * some comment
 */
-->
<config>
    <sections>
        <some_section translate="label">
            <label>Section Name</label>
            <tab>test</tab>
            <frontend_type>text</frontend_type>
            <sort_order>140</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <resource>Magento_Some::resource</resource>
        </some_section>
    </sections>
</config>
XML;
        $comment = <<<XMLCOMMENT

/**
 * some comment
 */

XMLCOMMENT;
        $expected = ['comment' => $comment, 'sections' => ['some_section' => ['label' => ['#text' => 'Section Name'], 'tab' => ['#text' => 'test'], 'frontend_type' => ['#text' => 'text'], 'sort_order' => ['#text' => '140'], 'show_in_default' => ['#text' => '1'], 'show_in_website' => ['#text' => '1'], 'show_in_store' => ['#text' => '1'], 'resource' => ['#text' => 'Magento_Some::resource'], '@attributes' => ['translate' => 'label']]]];
        $dom = new \DOMDocument();
        $dom->loadXML($xml);
        $this->assertEquals($expected, $this->_parser->parse($dom));
    }