Skip to content

Commit

Permalink
Ignore code from code coverage that is only executed when code covera…
Browse files Browse the repository at this point in the history
…ge information cannot be collected
  • Loading branch information
sebastianbergmann committed May 19, 2024
1 parent 1a5bdcf commit e1cc389
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/TextUI/Command/Commands/WarmCodeCoverageCacheCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @codeCoverageIgnore
*/
final class WarmCodeCoverageCacheCommand implements Command
{
Expand Down
9 changes: 9 additions & 0 deletions src/TextUI/Configuration/CodeCoverageFilterRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,19 @@ public static function instance(): self
return self::$instance;
}

/**
* @codeCoverageIgnore
*/
public function get(): Filter
{
assert($this->filter !== null);

return $this->filter;
}

/**
* @codeCoverageIgnore
*/
public function init(Configuration $configuration, bool $force = false): void
{
if (!$configuration->hasCoverageReport() && !$force) {
Expand All @@ -60,6 +66,9 @@ public function init(Configuration $configuration, bool $force = false): void
}
}

/**
* @codeCoverageIgnore
*/
public function configured(): bool
{
return $this->configured;
Expand Down
4 changes: 4 additions & 0 deletions src/TextUI/Configuration/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,17 @@ public static function saveTo(string $path): bool
return true;
}

// @codeCoverageIgnoreStart
return false;
// @codeCoverageIgnoreEnd
}

/**
* This method is used by the "run test(s) in separate process" templates.
*
* @noinspection PhpUnused
*
* @codeCoverageIgnore
*/
public static function loadFrom(string $path): void
{
Expand Down

0 comments on commit e1cc389

Please sign in to comment.