ReinitableConfig.php 872 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\TestFramework\App;
  7. use Magento\Framework\App\Config\ReinitableConfigInterface;
  8. use Magento\TestFramework\ObjectManager;
  9. /**
  10. * @inheritdoc
  11. */
  12. class ReinitableConfig extends MutableScopeConfig implements ReinitableConfigInterface
  13. {
  14. /**
  15. * @var Config
  16. */
  17. private $testAppConfig;
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public function reinit()
  22. {
  23. $this->getTestScopeConfig()->clean();
  24. return $this;
  25. }
  26. /**
  27. * Retrieve Test Scope Config
  28. *
  29. * @return Config
  30. */
  31. public function getTestScopeConfig()
  32. {
  33. if (!$this->testAppConfig) {
  34. $this->testAppConfig = ObjectManager::getInstance()->get(Config::class);
  35. }
  36. return $this->testAppConfig;
  37. }
  38. }