@@ -97,6 +97,15 @@ public function startTestSuite($suite)
97
97
$ suiteName = $ suite ->getName ();
98
98
$ this ->testsWithWarnings = array ();
99
99
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
+
100
109
if (-1 === $ this ->state ) {
101
110
echo "Testing $ suiteName \n" ;
102
111
$ this ->state = 0 ;
@@ -132,10 +141,6 @@ public function startTestSuite($suite)
132
141
if (in_array ('dns-sensitive ' , $ groups , true )) {
133
142
DnsMock::register ($ test ->getName ());
134
143
}
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 );
139
144
}
140
145
}
141
146
}
@@ -146,8 +151,6 @@ public function startTestSuite($suite)
146
151
|| isset ($ this ->wasSkipped [$ suiteName ]['* ' ])
147
152
|| isset ($ this ->wasSkipped [$ suiteName ][$ test ->getName ()])) {
148
153
$ skipped [] = $ test ;
149
- } elseif (null === $ Test ::getPreserveGlobalStateSettings (get_class ($ test ), $ test ->getName (false ))) {
150
- $ test ->setPreserveGlobalState (false );
151
154
}
152
155
}
153
156
$ suite ->setTests ($ skipped );
0 commit comments