protected function setUp()
 {
     $this->_fileResolverMock = $this->getMock('Magento\\Framework\\Config\\FileResolverInterface');
     $this->_fileResolverMock->expects($this->once())->method('get')->with('address_formats.xml', 'scope')->will($this->returnValue([file_get_contents(__DIR__ . '/_files/formats_one.xml'), file_get_contents(__DIR__ . '/_files/formats_two.xml')]));
     $this->_converter = $this->getMock('Magento\\Customer\\Model\\Address\\Config\\Converter', ['convert']);
     $moduleReader = $this->getMock('Magento\\Framework\\Module\\Dir\\Reader', ['getModuleDir'], [], '', false);
     $moduleReader->expects($this->once())->method('getModuleDir')->with('etc', 'Magento_Customer')->will($this->returnValue('stub'));
     $this->_schemaLocator = new \Magento\Customer\Model\Address\Config\SchemaLocator($moduleReader);
     $this->_validationState = $this->getMock('Magento\\Framework\\Config\\ValidationStateInterface');
     $this->_validationState->expects($this->once())->method('isValidated')->will($this->returnValue(false));
     $this->_model = new \Magento\Customer\Model\Address\Config\Reader($this->_fileResolverMock, $this->_converter, $this->_schemaLocator, $this->_validationState);
 }
Beispiel #2
0
 protected function setUp()
 {
     $this->_fileResolverMock = $this->getMock('Magento\\Framework\\Config\\FileResolverInterface');
     $this->_fileResolverMock->expects($this->once())->method('get')->with('catalog_attributes.xml', 'scope')->will($this->returnValue(array(file_get_contents(__DIR__ . '/_files/attributes_config_one.xml'), file_get_contents(__DIR__ . '/_files/attributes_config_two.xml'))));
     $this->_converter = $this->getMock('Magento\\Catalog\\Model\\Attribute\\Config\\Converter', array('convert'));
     $moduleReader = $this->getMock('Magento\\Framework\\Module\\Dir\\Reader', array('getModuleDir'), array(), '', false);
     $moduleReader->expects($this->once())->method('getModuleDir')->with('etc', 'Magento_Catalog')->will($this->returnValue('stub'));
     $this->_schemaLocator = new \Magento\Catalog\Model\Attribute\Config\SchemaLocator($moduleReader);
     $this->_validationState = $this->getMock('Magento\\Framework\\Config\\ValidationStateInterface');
     $this->_validationState->expects($this->once())->method('isValidated')->will($this->returnValue(false));
     $this->_model = new \Magento\Catalog\Model\Attribute\Config\Reader($this->_fileResolverMock, $this->_converter, $this->_schemaLocator, $this->_validationState);
 }
 protected function setUp()
 {
     $this->_fileResolverMock = $this->getMock('Magento\\Framework\\Config\\FileResolverInterface');
     $this->_fileResolverMock->expects($this->once())->method('get')->with('pdf.xml', 'scope')->will($this->returnValue([file_get_contents(__DIR__ . '/_files/pdf_one.xml'), file_get_contents(__DIR__ . '/_files/pdf_two.xml')]));
     $this->_converter = $this->getMock('Magento\\Sales\\Model\\Order\\Pdf\\Config\\Converter', ['convert']);
     $moduleReader = $this->getMock('Magento\\Framework\\Module\\Dir\\Reader', ['getModuleDir'], [], '', false);
     $moduleReader->expects($this->once())->method('getModuleDir')->with('etc', 'Magento_Sales')->will($this->returnValue('stub'));
     $this->_schemaLocator = new \Magento\Sales\Model\Order\Pdf\Config\SchemaLocator($moduleReader);
     $this->_validationState = $this->getMock('Magento\\Framework\\Config\\ValidationStateInterface');
     $this->_validationState->expects($this->any())->method('isValidationRequired')->willReturn(false);
     $this->_model = new \Magento\Sales\Model\Order\Pdf\Config\Reader($this->_fileResolverMock, $this->_converter, $this->_schemaLocator, $this->_validationState, 'pdf.xml');
 }
Beispiel #4
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']);
 }
 protected function setUp()
 {
     if (!function_exists('libxml_set_external_entity_loader')) {
         $this->markTestSkipped('Skipped on HHVM. Will be fixed in MAGETWO-45033');
     }
     $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->filePath = __DIR__ . '/_files/';
     $this->fileResolverMock = $this->getMock('Magento\\Framework\\Config\\FileResolverInterface');
     $this->converterMock = $this->getMock('Magento\\Framework\\App\\Config\\Initial\\Converter');
     $this->schemaLocatorMock = $this->getMock('Magento\\Framework\\App\\Config\\Initial\\SchemaLocator', [], [], '', false);
     $this->validationStateMock = $this->getMock('Magento\\Framework\\Config\\ValidationStateInterface');
     $this->validationStateMock->expects($this->any())->method('isValidationRequired')->will($this->returnValue(true));
     $this->domFactoryMock = $this->getMock('Magento\\Framework\\Config\\DomFactory', [], [], '', false);
 }
Beispiel #6
0
 protected function setUp()
 {
     $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->filePath = __DIR__ . '/_files/';
     $this->fileResolverMock = $this->getMock('Magento\Framework\Config\FileResolverInterface');
     $this->converterMock = $this->getMock('Magento\Framework\App\Config\Initial\Converter');
     $this->schemaLocatorMock = $this->getMock(
         'Magento\Framework\App\Config\Initial\SchemaLocator',
         [],
         [],
         '',
         false
     );
     $this->validationStateMock = $this->getMock('Magento\Framework\Config\ValidationStateInterface');
     $this->validationStateMock->expects($this->any())
         ->method('isValidationRequired')
         ->will($this->returnValue(true));
     $this->domFactoryMock = $this->getMock('Magento\Framework\Config\DomFactory', [], [], '', false);
 }