ConfigFilePoolTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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\File;
  7. use Magento\Framework\Config\File\ConfigFilePool;
  8. class ConfigFilePoolTest extends \PHPUnit\Framework\TestCase
  9. {
  10. /**
  11. * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Config\File\ConfigFilePool
  12. */
  13. private $configFilePool;
  14. protected function setUp()
  15. {
  16. $newPath = [
  17. 'new_key' => 'new_config.php'
  18. ];
  19. $this->configFilePool = new ConfigFilePool($newPath);
  20. }
  21. public function testGetPaths()
  22. {
  23. $expected['new_key'] = 'new_config.php';
  24. $expected[ConfigFilePool::APP_CONFIG] = 'config.php';
  25. $expected[ConfigFilePool::APP_ENV] = 'env.php';
  26. $this->assertEquals($expected, $this->configFilePool->getPaths());
  27. }
  28. public function testGetPath()
  29. {
  30. $expected = 'config.php';
  31. $this->assertEquals($expected, $this->configFilePool->getPath(ConfigFilePool::APP_CONFIG));
  32. }
  33. /**
  34. * @expectedException \Exception
  35. * @expectedExceptionMessage File config key does not exist.
  36. */
  37. public function testGetPathException()
  38. {
  39. $fileKey = 'not_existing';
  40. $this->configFilePool->getPath($fileKey);
  41. }
  42. }