Пример #1
0
 /**
  * Constructor
  *
  * @param \Magento\Framework\Config\FileResolverInterface $fileResolver
  * @param \Magento\Framework\Config\ConverterInterface $converter
  * @param \Magento\Framework\Config\SchemaLocatorInterface $schemaLocator
  * @param \Magento\Framework\Config\ValidationStateInterface $validationState
  * @param string $fileName
  * @param array $idAttributes
  * @param string $domDocumentClass
  * @param string $defaultScope
  */
 public function __construct(\Magento\Framework\Config\FileResolverInterface $fileResolver, \Magento\Framework\Config\ConverterInterface $converter, \Magento\Framework\Config\SchemaLocatorInterface $schemaLocator, \Magento\Framework\Config\ValidationStateInterface $validationState, $fileName, $idAttributes = [], $domDocumentClass = 'Magento\\Framework\\Config\\Dom', $defaultScope = 'global')
 {
     $this->_fileResolver = $fileResolver;
     $this->_converter = $converter;
     $this->_fileName = $fileName;
     $this->_idAttributes = array_replace($this->_idAttributes, $idAttributes);
     $this->_schemaFile = $schemaLocator->getSchema();
     $this->_isValidated = $validationState->isValidated();
     $this->_perFileSchema = $schemaLocator->getPerFileSchema() && $this->_isValidated ? $schemaLocator->getPerFileSchema() : null;
     $this->_domDocumentClass = $domDocumentClass;
     $this->_defaultScope = $defaultScope;
 }
Пример #2
0
 /**
  * Set up
  *
  * @return void
  */
 protected function setUp()
 {
     $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
     $this->fileUtility = \Magento\Framework\App\Utility\Files::init();
     $this->validationStateMock = $this->getMockBuilder('Magento\\Framework\\Config\\ValidationStateInterface')->setMethods(['isValidationRequired'])->getMockForAbstractClass();
     $this->schemaLocatorMock = $this->getMockBuilder('Magento\\Config\\Model\\Config\\SchemaLocator')->disableOriginalConstructor()->setMethods(['getPerFileSchema'])->getMock();
     $this->fileResolverMock = $this->getMockBuilder('Magento\\Framework\\Config\\FileResolverInterface')->getMockForAbstractClass();
     $this->validationStateMock->expects($this->atLeastOnce())->method('isValidationRequired')->willReturn(false);
     $this->schemaLocatorMock->expects($this->atLeastOnce())->method('getPerFileSchema')->willReturn(false);
     /** @var \Magento\Paypal\Model\Config\Structure\Reader\ConverterStub $converter */
     $this->converter = $this->objectManager->create('Magento\\Paypal\\Model\\Config\\Structure\\Reader\\ConverterStub');
     $this->reader = $this->objectManager->create('Magento\\Paypal\\Model\\Config\\Structure\\Reader\\ReaderStub', ['fileResolver' => $this->fileResolverMock, 'converter' => $this->converter, 'schemaLocator' => $this->schemaLocatorMock, 'validationState' => $this->validationStateMock, 'fileName' => 'no_existing_file.xml', 'domDocumentClass' => 'Magento\\Framework\\Config\\Dom']);
 }