Skip to content

Commit 38942db

Browse files
Merge branch '10.5' into 11.4
2 parents 24e6819 + cac7631 commit 38942db

File tree

1 file changed

+26
-32
lines changed

1 file changed

+26
-32
lines changed

src/Framework/TestSuite.php

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -148,29 +148,31 @@ public function addTest(Test $test, array $groups = []): void
148148

149149
$class = new ReflectionClass($test);
150150

151-
if (!$class->isAbstract()) {
152-
$this->tests[] = $test;
151+
if ($class->isAbstract()) {
152+
return;
153+
}
153154

154-
$this->clearCaches();
155+
$this->tests[] = $test;
155156

156-
if ($this->containsOnlyVirtualGroups($groups)) {
157-
$groups[] = 'default';
158-
}
157+
$this->clearCaches();
158+
159+
if ($this->containsOnlyVirtualGroups($groups)) {
160+
$groups[] = 'default';
161+
}
159162

160-
if ($test instanceof TestCase) {
161-
$id = $test->valueObjectForEvents()->id();
163+
if ($test instanceof TestCase) {
164+
$id = $test->valueObjectForEvents()->id();
162165

163-
$test->setGroups($groups);
164-
} else {
165-
$id = $test->valueObjectForEvents()->id();
166-
}
166+
$test->setGroups($groups);
167+
} else {
168+
$id = $test->valueObjectForEvents()->id();
169+
}
167170

168-
foreach ($groups as $group) {
169-
if (!isset($this->groups[$group])) {
170-
$this->groups[$group] = [$id];
171-
} else {
172-
$this->groups[$group][] = $id;
173-
}
171+
foreach ($groups as $group) {
172+
if (!isset($this->groups[$group])) {
173+
$this->groups[$group] = [$id];
174+
} else {
175+
$this->groups[$group][] = $id;
174176
}
175177
}
176178
}
@@ -221,23 +223,15 @@ public function addTestSuite(ReflectionClass $testClass, array $groups = []): vo
221223
*/
222224
public function addTestFile(string $filename, array $groups = []): void
223225
{
224-
if (str_ends_with($filename, '.phpt') && is_file($filename)) {
225-
try {
226+
try {
227+
if (str_ends_with($filename, '.phpt') && is_file($filename)) {
226228
$this->addTest(new PhptTestCase($filename));
227-
} catch (RunnerException $e) {
228-
Event\Facade::emitter()->testRunnerTriggeredWarning(
229-
$e->getMessage(),
229+
} else {
230+
$this->addTestSuite(
231+
(new TestSuiteLoader)->load($filename),
232+
$groups,
230233
);
231234
}
232-
233-
return;
234-
}
235-
236-
try {
237-
$this->addTestSuite(
238-
(new TestSuiteLoader)->load($filename),
239-
$groups,
240-
);
241235
} catch (RunnerException $e) {
242236
Event\Facade::emitter()->testRunnerTriggeredWarning(
243237
$e->getMessage(),

0 commit comments

Comments
 (0)