Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 82b36e4

Browse files
[Bridge/PhpUnit] Fix disabling global state preservation
1 parent fde2874 commit 82b36e4

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,15 @@ public function startTestSuite($suite)
9797
$suiteName = $suite->getName();
9898
$this->testsWithWarnings = array();
9999

100+
foreach ($suite->tests() as $test) {
101+
if (!($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)) {
102+
continue;
103+
}
104+
if (null === $Test::getPreserveGlobalStateSettings(get_class($test), $test->getName(false))) {
105+
$test->setPreserveGlobalState(false);
106+
}
107+
}
108+
100109
if (-1 === $this->state) {
101110
echo "Testing $suiteName\n";
102111
$this->state = 0;
@@ -132,10 +141,6 @@ public function startTestSuite($suite)
132141
if (in_array('dns-sensitive', $groups, true)) {
133142
DnsMock::register($test->getName());
134143
}
135-
} elseif (!($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)) {
136-
// no-op
137-
} elseif (null === $Test::getPreserveGlobalStateSettings(get_class($test), $test->getName(false))) {
138-
$test->setPreserveGlobalState(false);
139144
}
140145
}
141146
}
@@ -146,8 +151,6 @@ public function startTestSuite($suite)
146151
|| isset($this->wasSkipped[$suiteName]['*'])
147152
|| isset($this->wasSkipped[$suiteName][$test->getName()])) {
148153
$skipped[] = $test;
149-
} elseif (null === $Test::getPreserveGlobalStateSettings(get_class($test), $test->getName(false))) {
150-
$test->setPreserveGlobalState(false);
151154
}
152155
}
153156
$suite->setTests($skipped);

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
// Please update when phpunit needs to be reinstalled with fresh deps:
14-
// Cache-Id-Version: 2017-11-22 09:00 UTC
14+
// Cache-Id-Version: 2017-11-22 09:30 UTC
1515

1616
error_reporting(-1);
1717

0 commit comments

Comments
 (0)