From 28305fcb7a15ed9cfac516030548f67aab8b49c2 Mon Sep 17 00:00:00 2001 From: nuno maduro Date: Sat, 2 May 2026 16:35:52 +0100 Subject: [PATCH] wip --- .../EnsureTiaIsRunningPestTestsOnly.php | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/Subscribers/EnsureTiaIsRunningPestTestsOnly.php b/src/Subscribers/EnsureTiaIsRunningPestTestsOnly.php index 305490f6..413e8956 100644 --- a/src/Subscribers/EnsureTiaIsRunningPestTestsOnly.php +++ b/src/Subscribers/EnsureTiaIsRunningPestTestsOnly.php @@ -4,14 +4,12 @@ declare(strict_types=1); namespace Pest\Subscribers; -use Pest\Concerns\Testable; use Pest\Exceptions\TiaRequiresPestTests; use Pest\Panic; use Pest\Plugins\Tia\Recorder; use PHPUnit\Event\Code\TestMethod; use PHPUnit\Event\Test\Prepared; use PHPUnit\Event\Test\PreparedSubscriber; -use ReflectionClass; /** * @internal @@ -38,30 +36,10 @@ final readonly class EnsureTiaIsRunningPestTestsOnly implements PreparedSubscrib return; } - if ($this->usesTestableTrait($className)) { + if (method_exists($className, '__initializeTestCase')) { return; } Panic::with(new TiaRequiresPestTests($className, $test->file())); } - - /** - * @param class-string $className - */ - private function usesTestableTrait(string $className): bool - { - $reflection = new ReflectionClass($className); - - do { - foreach ($reflection->getTraitNames() as $trait) { - if ($trait === Testable::class) { - return true; - } - } - - $reflection = $reflection->getParentClass(); - } while ($reflection !== false); - - return false; - } }