SchemaLocatorTest.php 1.3 KB

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