19 private $_hasNonIsolatedTests =
true;
24 private $_application;
29 private $serverGlobalBackup;
46 if ($this->_hasNonIsolatedTests) {
47 $this->_application->reinitialize();
50 session_write_close();
51 $this->_hasNonIsolatedTests =
false;
60 $this->serverGlobalBackup = $_SERVER;
69 $_SERVER = $this->serverGlobalBackup;
78 public function endTest(\PHPUnit\Framework\TestCase $test)
80 $this->_hasNonIsolatedTests =
true;
83 $annotations = $test->getAnnotations();
84 $annotations = array_replace((array) $annotations[
'class'], (array) $annotations[
'method']);
85 if (isset($annotations[
'magentoAppIsolation'])) {
86 $isolation = $annotations[
'magentoAppIsolation'];
87 if ($isolation !== [
'enabled'] && $isolation !== [
'disabled']) {
88 throw new \Magento\Framework\Exception\LocalizedException(
89 __(
'Invalid "@magentoAppIsolation" annotation, can be "enabled" or "disabled" only.')
92 $isIsolationEnabled = $isolation === [
'enabled'];
95 $isIsolationEnabled = $test instanceof \Magento\TestFramework\TestCase\AbstractController;
98 if ($isIsolationEnabled) {
__construct(\Magento\TestFramework\Application $application)
endTest(\PHPUnit\Framework\TestCase $test)