SchemaLocatorTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Cron\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\Cron\Model\Config\SchemaLocator
  15. */
  16. protected $_locator;
  17. /**
  18. * Initialize parameters
  19. */
  20. protected function setUp()
  21. {
  22. $this->_moduleReaderMock = $this->getMockBuilder(
  23. \Magento\Framework\Module\Dir\Reader::class
  24. )->disableOriginalConstructor()->getMock();
  25. $this->_moduleReaderMock->expects(
  26. $this->once()
  27. )->method(
  28. 'getModuleDir'
  29. )->with(
  30. 'etc',
  31. 'Magento_Cron'
  32. )->will(
  33. $this->returnValue('schema_dir')
  34. );
  35. $this->_locator = new \Magento\Cron\Model\Config\SchemaLocator($this->_moduleReaderMock);
  36. }
  37. /**
  38. * Testing that schema has file
  39. */
  40. public function testGetSchema()
  41. {
  42. $this->assertEquals('schema_dir/crontab.xsd', $this->_locator->getSchema());
  43. }
  44. }