ModularConfigSourceTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Config\Test\Unit\App\Config\Source;
  7. use Magento\Config\App\Config\Source\ModularConfigSource;
  8. use Magento\Framework\App\Config\Initial\Reader;
  9. /**
  10. * Test config source that is retrieved from config.xml
  11. *
  12. * @package Magento\Config\Test\Unit\App\Config\Source
  13. */
  14. class ModularConfigSourceTest extends \PHPUnit\Framework\TestCase
  15. {
  16. /**
  17. * @var Reader|\PHPUnit_Framework_MockObject_MockObject
  18. */
  19. private $reader;
  20. /**
  21. * @var ModularConfigSource
  22. */
  23. private $source;
  24. public function setUp()
  25. {
  26. $this->reader = $this->getMockBuilder(Reader::class)
  27. ->disableOriginalConstructor()
  28. ->getMock();
  29. $this->source = new ModularConfigSource($this->reader);
  30. }
  31. public function testGet()
  32. {
  33. $this->reader->expects($this->once())
  34. ->method('read')
  35. ->willReturn(['data' => ['path' => 'value']]);
  36. $this->assertEquals('value', $this->source->get('path'));
  37. }
  38. }