From 4e25805e2b37f27680b02249bc2c415299fe6b36 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sun, 28 Apr 2024 19:32:33 +0200 Subject: [PATCH] Ignore methods from code coverage that are only called when code coverage information cannot be collected --- src/Framework/TestCase.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index cc60353219..67905a84d6 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -666,7 +666,9 @@ final public function runBare(): void $hasMetRequirements = true; if ($this->inIsolation) { + // @codeCoverageIgnoreStart $this->invokeBeforeClassHookMethods($hookMethods, $emitter); + // @codeCoverageIgnoreEnd } if (method_exists(static::class, $this->name) && @@ -780,7 +782,9 @@ final public function runBare(): void $this->invokeAfterTestHookMethods($hookMethods, $emitter); if ($this->inIsolation) { + // @codeCoverageIgnoreStart $this->invokeAfterClassHookMethods($hookMethods, $emitter); + // @codeCoverageIgnoreEnd } } } catch (AssertionError|AssertionFailedError $e) { @@ -852,6 +856,8 @@ final public function setDependencies(array $dependencies): void /** * @internal This method is not covered by the backward compatibility promise for PHPUnit + * + * @codeCoverageIgnore */ final public function setDependencyInput(array $dependencyInput): void { @@ -2065,6 +2071,8 @@ private function performAssertionsOnOutput(): void /** * @throws Throwable + * + * @codeCoverageIgnore */ private function invokeBeforeClassHookMethods(array $hookMethods, Event\Emitter $emitter): void { @@ -2130,6 +2138,8 @@ private function invokeAfterTestHookMethods(array $hookMethods, Event\Emitter $e /** * @throws Throwable + * + * @codeCoverageIgnore */ private function invokeAfterClassHookMethods(array $hookMethods, Event\Emitter $emitter): void {