ReaderTest.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\Framework\Config\Test\Unit;
  7. use Magento\Framework\App\Config\Reader\Source\SourceInterface;
  8. use Magento\Framework\App\Config\Scope\Converter;
  9. use Magento\Framework\Config\Reader;
  10. use Magento\Framework\Stdlib\ArrayUtils;
  11. class ReaderTest extends \PHPUnit\Framework\TestCase
  12. {
  13. /**
  14. * @var SourceInterface|\PHPUnit_Framework_MockObject_MockObject
  15. */
  16. private $source;
  17. /**
  18. * @var Reader
  19. */
  20. private $reader;
  21. public function setUp()
  22. {
  23. $this->source = $this->getMockBuilder(SourceInterface::class)
  24. ->getMockForAbstractClass();
  25. $this->reader = new Reader([['class' => $this->source]]);
  26. }
  27. public function testRead()
  28. {
  29. $config = [
  30. 'default' => [
  31. 'general/locale/code'=> 'ru_RU',
  32. 'general/locale/timezone'=> 'America/Chicago',
  33. ]
  34. ];
  35. $this->source->expects($this->once())
  36. ->method('get')
  37. ->with(null)
  38. ->willReturn($config);
  39. $this->assertEquals($config, $this->reader->read());
  40. }
  41. }