Skip to content

Commit

Permalink
Add fixes for new override features in 2.4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jissereitsma committed Nov 12, 2020
1 parent a004f4b commit 3a871f9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
8 changes: 7 additions & 1 deletion framework/ReachDigital/TestFramework/Bootstrap/DocBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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;
}
}
16 changes: 15 additions & 1 deletion framework/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3a871f9

Please sign in to comment.