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
7878 $ file ->getBasename ('.php ' ),
7979 );
8080
81- if (! class_exists ($ sourceClass )) {
81+ if (! class_exists ($ sourceClass ) && ! trait_exists ( $ sourceClass ) ) {
8282 continue ;
8383 }
8484
Original file line number Diff line number Diff line change 2424use PHPUnit \Framework \Attributes \CoversClass ;
2525use PHPUnit \Framework \Attributes \CoversFunction ;
2626use PHPUnit \Framework \Attributes \CoversNothing ;
27+ use PHPUnit \Framework \Attributes \CoversTrait ;
2728use PHPUnit \Framework \Attributes \DataProvider ;
2829use PHPUnit \Framework \Attributes \Group ;
2930use PHPUnit \Framework \TestCase ;
@@ -271,9 +272,10 @@ public function testEachTestClassHasCorrectCovers(string $class): void
271272 }
272273
273274 $ functions = $ rc ->getAttributes (CoversFunction::class);
275+ $ traits = $ rc ->getAttributes (CoversTrait::class);
274276 $ classes = $ rc ->getAttributes (CoversClass::class);
275277
276- if ([] !== $ functions && [] === $ classes ) {
278+ if (( [] !== $ functions || [] !== $ traits ) && [] === $ classes ) {
277279 $ this ->expectNotToPerformAssertions ();
278280
279281 return ;
You can’t perform that action at this time.
0 commit comments