Пример #1
0
 /**
  * Get configuration per file
  *
  * @return array
  */
 public function getConfiguration()
 {
     $files = $this->_fileManager->getFileList($this->_basePath . DIRECTORY_SEPARATOR . Tools_Migration_System_Configuration_Reader::SYSTEM_CONFIG_PATH_PATTERN);
     $result = array();
     foreach ($files as $fileName) {
         $result[$fileName] = $this->_mapper->transform($this->_parser->parse($this->_getDOMDocument($this->_fileManager->getContents($fileName))));
     }
     return $result;
 }
Пример #2
0
    public function testParseDomNodes()
    {
        $xml = <<<XML
<?xml version="1.0"?>
<!--
/**
 * some comment
 */
-->
<config>
    <sections>
        <some_section translate="label" module="Mage_Some">
            <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>Mage_Some::resource</resource>
        </some_section>
    </sections>
</config>
XML;
        $comment = <<<XMLCOMMENT

/**
 * some comment
 */

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