AppConfig.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\TestFramework\Isolation;
  7. use Magento\TestFramework\App\Config;
  8. use Magento\TestFramework\ObjectManager;
  9. /**
  10. * A listener that watches for integrity of app configuration
  11. */
  12. class AppConfig
  13. {
  14. /**
  15. * @var Config
  16. */
  17. private $testAppConfig;
  18. /**
  19. * Clean memorized and cached setting values
  20. *
  21. * Assumption: this is done once right before executing very first test suite.
  22. * It is assumed that deployment configuration is valid at this point
  23. *
  24. * @param \PHPUnit\Framework\TestCase $test
  25. * @return void
  26. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  27. */
  28. public function startTest(\PHPUnit\Framework\TestCase $test)
  29. {
  30. $this->getTestAppConfig()->clean();
  31. }
  32. /**
  33. * Retrieve Test App Config
  34. *
  35. * @return Config
  36. */
  37. private function getTestAppConfig()
  38. {
  39. if (!$this->testAppConfig) {
  40. $this->testAppConfig = ObjectManager::getInstance()->get(Config::class);
  41. }
  42. return $this->testAppConfig;
  43. }
  44. }