SchemaLocatorTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Config\Test\Unit\Model\Config;
  7. class SchemaLocatorTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /**
  10. * @var \PHPUnit_Framework_MockObject_MockObject
  11. */
  12. protected $_moduleReaderMock;
  13. /**
  14. * @var \Magento\Config\Model\Config\SchemaLocator
  15. */
  16. protected $_model;
  17. protected function setUp()
  18. {
  19. $this->_moduleReaderMock = $this->createMock(\Magento\Framework\Module\Dir\Reader::class);
  20. $this->_moduleReaderMock->expects(
  21. $this->any()
  22. )->method(
  23. 'getModuleDir'
  24. )->with(
  25. 'etc',
  26. 'Magento_Config'
  27. )->will(
  28. $this->returnValue('schema_dir')
  29. );
  30. $this->_model = new \Magento\Config\Model\Config\SchemaLocator($this->_moduleReaderMock);
  31. }
  32. public function testGetSchema()
  33. {
  34. $this->assertEquals('schema_dir/system.xsd', $this->_model->getSchema());
  35. }
  36. public function testGetPerFileSchema()
  37. {
  38. $this->assertEquals('schema_dir/system_file.xsd', $this->_model->getPerFileSchema());
  39. }
  40. }