File tree Expand file tree Collapse file tree 1 file changed +17
-14
lines changed Expand file tree Collapse file tree 1 file changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -160,15 +160,22 @@ public function toString(): string
160
160
*/
161
161
public function addTest (Test $ test , array $ groups = []): void
162
162
{
163
+ if ($ test instanceof self) {
164
+ $ this ->tests [] = $ test ;
165
+
166
+ $ this ->clearCaches ();
167
+
168
+ return ;
169
+ }
170
+
171
+ assert ($ test instanceof TestCase || $ test instanceof PhptTestCase);
172
+
163
173
$ class = new ReflectionClass ($ test );
164
174
165
175
if (!$ class ->isAbstract ()) {
166
176
$ this ->tests [] = $ test ;
167
- $ this ->clearCaches ();
168
177
169
- if ($ test instanceof self && empty ($ groups )) {
170
- $ groups = $ test ->groups ();
171
- }
178
+ $ this ->clearCaches ();
172
179
173
180
if ($ this ->containsOnlyVirtualGroups ($ groups )) {
174
181
$ groups [] = 'default ' ;
@@ -178,19 +185,15 @@ public function addTest(Test $test, array $groups = []): void
178
185
$ id = $ test ->valueObjectForEvents ()->id ();
179
186
180
187
$ test ->setGroups ($ groups );
181
- }
182
-
183
- if ($ test instanceof PhptTestCase) {
188
+ } else {
184
189
$ id = $ test ->valueObjectForEvents ()->id ();
185
190
}
186
191
187
- if (isset ($ id )) {
188
- foreach ($ groups as $ group ) {
189
- if (!isset ($ this ->groups [$ group ])) {
190
- $ this ->groups [$ group ] = [$ id ];
191
- } else {
192
- $ this ->groups [$ group ][] = $ id ;
193
- }
192
+ foreach ($ groups as $ group ) {
193
+ if (!isset ($ this ->groups [$ group ])) {
194
+ $ this ->groups [$ group ] = [$ id ];
195
+ } else {
196
+ $ this ->groups [$ group ][] = $ id ;
194
197
}
195
198
}
196
199
}
You can’t perform that action at this time.
0 commit comments