File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change 44
55namespace Qameta \Allure \PHPUnit \Test \Unit ;
66
7+ // phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses
8+
79use Exception ;
810use PHPUnit \Framework \TestCase ;
11+ use PHPUnit \Framework \Attributes \CoversClass ;
12+ use PHPUnit \Framework \Attributes \CoversTrait ;
913use Qameta \Allure \PHPUnit \ExceptionDetailsTrait ;
1014use Qameta \Allure \PHPUnit \AllureAdapter ;
1115use Qameta \Allure \PHPUnit \AllureAdapterInterface ;
1216use Throwable ;
1317
14- // #[CoversTrait(ExceptionDetailsTrait::class)] <--- needed by phpunit 12
15- // #[CoversClass(ExceptionDetailsTrait::class)] <--- needed by phpunit 10 + 11
16- final class ExceptionDetailsTraitTest extends TestCase
18+ abstract class ExceptionDetailsTraitTestBase extends TestCase
1719{
1820 public function testOnNotSuccessfulTest_GivenException_ThrowsSameException (): void
1921 {
@@ -49,3 +51,19 @@ public function testOnNotSuccessfulTest_GivenException_SetsSameExceptionAsLast()
4951 }
5052 }
5153}
54+
55+ if (class_exists (CoversTrait::class)) {
56+ // Since PHPUnit 11.2.0 (deprecation has been reverted in 11.5.4)
57+ #[CoversTrait(ExceptionDetailsTrait::class)]
58+ final class ExceptionDetailsTraitTest extends ExceptionDetailsTraitTestBase
59+ {
60+ }
61+
62+ } else {
63+ // For PHPUnit <11.2.0
64+ #[CoversClass(ExceptionDetailsTrait::class)]
65+ final class ExceptionDetailsTraitTest extends ExceptionDetailsTraitTestBase
66+ {
67+ }
68+
69+ }
You can’t perform that action at this time.
0 commit comments