Skip to content

Commit c623f14

Browse files
authored
Merge pull request #41 from jdecool/fix-execution-on-error
Fix fatal error when an exception throws in PHPUnit
2 parents 530b8c6 + bedb1eb commit c623f14

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/AnnotationExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace Zalas\PHPUnit\Globals;
55

6+
use PHPUnit\Framework\TestCase;
67
use PHPUnit\Runner\AfterTestHook;
78
use PHPUnit\Runner\BeforeTestHook;
89
use PHPUnit\Util\Test;
@@ -121,7 +122,7 @@ private function parseTestMethodAnnotations(string $test): array
121122
{
122123
$parts = \preg_split('/ |::/', $test);
123124

124-
if (!\class_exists($parts[0])) {
125+
if (!\class_exists($parts[0]) || !\is_subclass_of($parts[0], TestCase::class)) {
125126
return [];
126127
}
127128

src/AttributeExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace Zalas\PHPUnit\Globals;
55

6+
use PHPUnit\Framework\TestCase;
67
use PHPUnit\Runner\AfterTestHook;
78
use PHPUnit\Runner\BeforeTestHook;
89
use Zalas\PHPUnit\Globals\Attribute\Env;
@@ -128,7 +129,7 @@ private function parseTestMethodAttributes(string $test): array
128129
{
129130
$parts = \preg_split('/ |::/', $test);
130131

131-
if (!\class_exists($parts[0])) {
132+
if (!\class_exists($parts[0]) || !\is_subclass_of($parts[0], TestCase::class)) {
132133
return [];
133134
}
134135

0 commit comments

Comments
 (0)