/** * 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; }
/** * Create configuration array from xml file * * @param string $fileName * @param array $configuration */ public function createConfiguration($fileName, array $configuration) { $domDocument = $this->_createDOMDocument($configuration); if (@(!$domDocument->schemaValidate($this->_fileSchemaPath))) { $this->_logger->add($this->_removeBasePath($fileName), Tools_Migration_System_Configuration_LoggerAbstract::FILE_KEY_INVALID); } else { $this->_logger->add($this->_removeBasePath($fileName), Tools_Migration_System_Configuration_LoggerAbstract::FILE_KEY_VALID); } $output = $this->_xmlFormatter->parseString($domDocument->saveXml(), array('indent' => true, 'input-xml' => true, 'output-xml' => true, 'add-xml-space' => false, 'indent-spaces' => 4, 'wrap' => 1000)); $newFileName = $this->_getPathToSave($fileName); $this->_fileManager->write($newFileName, $output); }
public function testGetFileList() { $expected = array('file1', 'file2'); $this->_readerMock->expects($this->once())->method('getFileList')->with('pattern')->will($this->returnValue($expected)); $this->assertEquals($expected, $this->_model->getFileList('pattern')); }
/** * Put report to file */ public function report() { $this->_fileManager->write($this->_file, (string) $this); }