diff --git a/framework/ReachDigital/TestFramework/Bootstrap/DocBlock.php b/framework/ReachDigital/TestFramework/Bootstrap/DocBlock.php index 6b9660b..59aa71a 100644 --- a/framework/ReachDigital/TestFramework/Bootstrap/DocBlock.php +++ b/framework/ReachDigital/TestFramework/Bootstrap/DocBlock.php @@ -11,7 +11,7 @@ class DocBlock extends \Magento\TestFramework\Bootstrap\DocBlock protected function _getSubscribers(\Magento\TestFramework\Application $application) { - return [ + $subscribers = [ new \Magento\TestFramework\Workaround\Segfault(), // new \Magento\TestFramework\Workaround\Cleanup\TestCaseProperties(), // new \Magento\TestFramework\Workaround\Cleanup\StaticProperties(), @@ -36,5 +36,11 @@ protected function _getSubscribers(\Magento\TestFramework\Application $applicati new \Magento\TestFramework\Annotation\AdminConfigFixture(), new \Magento\TestFramework\Annotation\ConfigFixture(), ]; + + if (class_exists(\Magento\TestFramework\Workaround\Override\Fixture\Resolver\TestSetter::class)) { + $subscribers[] = new \Magento\TestFramework\Workaround\Override\Fixture\Resolver\TestSetter(); + } + + return $subscribers; } } diff --git a/framework/bootstrap.php b/framework/bootstrap.php index 95b5bd8..0fb2f2a 100644 --- a/framework/bootstrap.php +++ b/framework/bootstrap.php @@ -133,8 +133,22 @@ new Magento\Framework\App\Utility\Files(new ComponentRegistrar(), $dirSearch, $themePackageList) ); + if (class_exists(\Magento\TestFramework\Workaround\Override\Config::class)) { + /** @var \Magento\TestFramework\Workaround\Override\Config $overrideConfig */ + $overrideConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + Magento\TestFramework\Workaround\Override\Config::class + ); + $overrideConfig->init(); + Magento\TestFramework\Workaround\Override\Config::setInstance($overrideConfig); + Magento\TestFramework\Workaround\Override\Fixture\Resolver::setInstance( + new \Magento\TestFramework\Workaround\Override\Fixture\Resolver($overrideConfig) + ); + } else { + $overrideConfig = null; + } + /* Unset declared global variables to release the PHPUnit from maintaining their values between tests */ - unset($testsBaseDir, $logWriter, $settings, $shell, $application, $bootstrap); + unset($testsBaseDir, $logWriter, $settings, $shell, $application, $bootstrap, $overrideConfig); } catch (Exception $e) { // phpcs:ignore Magento2.Security.LanguageConstruct.DirectOutput echo $e . PHP_EOL;