From aa5d1e7f5ad66f6987495712b8c98f3eb1a037de Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Fri, 3 Nov 2023 22:26:36 -0400 Subject: [PATCH] chore: refactors --- src/Factory.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Factory.php b/src/Factory.php index ffab802..b8fbb1c 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -8,6 +8,7 @@ use Pest\Stressless\ValueObjects\Result; use Pest\Stressless\ValueObjects\Url; use Pest\TestSuite; +use PHPUnit\Framework\TestCase; /** * @internal @@ -139,10 +140,19 @@ public function __get(string $name): mixed return $this->{$name}(); // @phpstan-ignore-line } + /** + * Destructs the run factory. + */ public function __destruct() { - if (! $this->result instanceof Result && TestSuite::getInstance()->test === null) { - $this->dd(); + if ($this->result instanceof Result) { + return; } + + if (TestSuite::getInstance()->test instanceof TestCase) { + return; + } + + $this->dd(); } }