Example #1
0
 /**
  * @covers \Magento\Tools\Migration\System\Configuration\AbstractLogger::add()
  * @covers \Magento\Tools\Migration\System\Configuration\AbstractLogger::__toString()
  */
 public function testToString()
 {
     $this->_model->add('file1', \Magento\Tools\Migration\System\Configuration\AbstractLogger::FILE_KEY_VALID);
     $this->_model->add('file2', \Magento\Tools\Migration\System\Configuration\AbstractLogger::FILE_KEY_INVALID);
     $expected = 'valid: 1' . PHP_EOL . 'invalid: 1' . PHP_EOL . 'Total: 2' . PHP_EOL . '------------------------------' . PHP_EOL . 'valid:' . PHP_EOL . 'file1' . PHP_EOL . '------------------------------' . PHP_EOL . 'invalid:' . PHP_EOL . 'file2';
     $this->assertEquals($expected, (string) $this->_model);
 }
Example #2
0
 /**
  * Create configuration array from xml file
  *
  * @param string $fileName
  * @param array $configuration
  * @return void
  */
 public function createConfiguration($fileName, array $configuration)
 {
     $domDocument = $this->_createDOMDocument($configuration);
     if (@(!$domDocument->schemaValidate($this->_fileSchemaPath))) {
         $this->_logger->add($this->_removeBasePath($fileName), AbstractLogger::FILE_KEY_INVALID);
     } else {
         $this->_logger->add($this->_removeBasePath($fileName), AbstractLogger::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);
 }