Skip to content

Commit 4e25805

Browse files
Ignore methods from code coverage that are only called when code coverage information cannot be collected
1 parent 68ca073 commit 4e25805

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Framework/TestCase.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,9 @@ final public function runBare(): void
666666
$hasMetRequirements = true;
667667

668668
if ($this->inIsolation) {
669+
// @codeCoverageIgnoreStart
669670
$this->invokeBeforeClassHookMethods($hookMethods, $emitter);
671+
// @codeCoverageIgnoreEnd
670672
}
671673

672674
if (method_exists(static::class, $this->name) &&
@@ -780,7 +782,9 @@ final public function runBare(): void
780782
$this->invokeAfterTestHookMethods($hookMethods, $emitter);
781783

782784
if ($this->inIsolation) {
785+
// @codeCoverageIgnoreStart
783786
$this->invokeAfterClassHookMethods($hookMethods, $emitter);
787+
// @codeCoverageIgnoreEnd
784788
}
785789
}
786790
} catch (AssertionError|AssertionFailedError $e) {
@@ -852,6 +856,8 @@ final public function setDependencies(array $dependencies): void
852856

853857
/**
854858
* @internal This method is not covered by the backward compatibility promise for PHPUnit
859+
*
860+
* @codeCoverageIgnore
855861
*/
856862
final public function setDependencyInput(array $dependencyInput): void
857863
{
@@ -2065,6 +2071,8 @@ private function performAssertionsOnOutput(): void
20652071

20662072
/**
20672073
* @throws Throwable
2074+
*
2075+
* @codeCoverageIgnore
20682076
*/
20692077
private function invokeBeforeClassHookMethods(array $hookMethods, Event\Emitter $emitter): void
20702078
{
@@ -2130,6 +2138,8 @@ private function invokeAfterTestHookMethods(array $hookMethods, Event\Emitter $e
21302138

21312139
/**
21322140
* @throws Throwable
2141+
*
2142+
* @codeCoverageIgnore
21332143
*/
21342144
private function invokeAfterClassHookMethods(array $hookMethods, Event\Emitter $emitter): void
21352145
{

0 commit comments

Comments
 (0)