diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index 40ff2783ade..2edb160e919 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -686,11 +686,9 @@ public function run(TestResult $result = null): TestResult return $result; } - $runEntireClass = $this->runClassInSeparateProcess && !$this->runTestInSeparateProcess; + if ($this->runInSeparateProcess()) { + $runEntireClass = $this->runClassInSeparateProcess && !$this->runTestInSeparateProcess; - if (($this->runTestInSeparateProcess === true || $this->runClassInSeparateProcess === true) && - $this->inIsolation !== true && - !$this instanceof PhptTestCase) { $class = new ReflectionClass($this); if ($runEntireClass) { @@ -2114,4 +2112,10 @@ private function checkExceptionExpectations(Throwable $throwable): bool return $result; } + + private function runInSeparateProcess(): bool + { + return ($this->runTestInSeparateProcess === true || $this->runClassInSeparateProcess === true) && + $this->inIsolation !== true && !$this instanceof PhptTestCase; + } }