File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ private static function getSourceClasses(): array
78
78
$ file ->getBasename ('.php ' ),
79
79
);
80
80
81
- if (! class_exists ($ sourceClass )) {
81
+ if (! class_exists ($ sourceClass ) && ! trait_exists ( $ sourceClass ) ) {
82
82
continue ;
83
83
}
84
84
Original file line number Diff line number Diff line change 24
24
use PHPUnit \Framework \Attributes \CoversClass ;
25
25
use PHPUnit \Framework \Attributes \CoversFunction ;
26
26
use PHPUnit \Framework \Attributes \CoversNothing ;
27
+ use PHPUnit \Framework \Attributes \CoversTrait ;
27
28
use PHPUnit \Framework \Attributes \DataProvider ;
28
29
use PHPUnit \Framework \Attributes \Group ;
29
30
use PHPUnit \Framework \TestCase ;
@@ -271,9 +272,10 @@ public function testEachTestClassHasCorrectCovers(string $class): void
271
272
}
272
273
273
274
$ functions = $ rc ->getAttributes (CoversFunction::class);
275
+ $ traits = $ rc ->getAttributes (CoversTrait::class);
274
276
$ classes = $ rc ->getAttributes (CoversClass::class);
275
277
276
- if ([] !== $ functions && [] === $ classes ) {
278
+ if (( [] !== $ functions || [] !== $ traits ) && [] === $ classes ) {
277
279
$ this ->expectNotToPerformAssertions ();
278
280
279
281
return ;
You can’t perform that action at this time.
0 commit comments