Skip to content

Commit

Permalink
Merge pull request #41 from jdecool/fix-execution-on-error
Browse files Browse the repository at this point in the history
Fix fatal error when an exception throws in PHPUnit
  • Loading branch information
jakzal authored Apr 8, 2023
2 parents 530b8c6 + bedb1eb commit c623f14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/AnnotationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Zalas\PHPUnit\Globals;

use PHPUnit\Framework\TestCase;
use PHPUnit\Runner\AfterTestHook;
use PHPUnit\Runner\BeforeTestHook;
use PHPUnit\Util\Test;
Expand Down Expand Up @@ -121,7 +122,7 @@ private function parseTestMethodAnnotations(string $test): array
{
$parts = \preg_split('/ |::/', $test);

if (!\class_exists($parts[0])) {
if (!\class_exists($parts[0]) || !\is_subclass_of($parts[0], TestCase::class)) {
return [];
}

Expand Down
3 changes: 2 additions & 1 deletion src/AttributeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Zalas\PHPUnit\Globals;

use PHPUnit\Framework\TestCase;
use PHPUnit\Runner\AfterTestHook;
use PHPUnit\Runner\BeforeTestHook;
use Zalas\PHPUnit\Globals\Attribute\Env;
Expand Down Expand Up @@ -128,7 +129,7 @@ private function parseTestMethodAttributes(string $test): array
{
$parts = \preg_split('/ |::/', $test);

if (!\class_exists($parts[0])) {
if (!\class_exists($parts[0]) || !\is_subclass_of($parts[0], TestCase::class)) {
return [];
}

Expand Down

0 comments on commit c623f14

Please sign in to comment.