Skip to content

Commit b0a13f4

Browse files
Do not query phpunit/php-code-coverage for a setting that PHPUnit set
1 parent 32ca171 commit b0a13f4

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/Runner/CodeCoverage.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ final class CodeCoverage
6161
private ?Timer $timer = null;
6262
private bool $requireCoverageContribution = false;
6363
private bool $lastTestContributedToCoverage = false;
64+
private bool $collectsBranchAndPathCoverage = false;
6465

6566
public static function instance(): self
6667
{
@@ -272,9 +273,15 @@ public function lastTestContributedToCoverage(): bool
272273

273274
public function deactivate(): void
274275
{
275-
$this->driver = null;
276-
$this->codeCoverage = null;
277-
$this->test = null;
276+
$this->driver = null;
277+
$this->codeCoverage = null;
278+
$this->test = null;
279+
$this->collectsBranchAndPathCoverage = false;
280+
}
281+
282+
public function collectsBranchAndPathCoverage(): bool
283+
{
284+
return $this->collectsBranchAndPathCoverage;
278285
}
279286

280287
public function generateReports(Printer $printer, Configuration $configuration): void
@@ -491,6 +498,8 @@ private function activate(Filter $filter, bool $pathCoverage): void
491498
$this->driver,
492499
$filter,
493500
);
501+
502+
$this->collectsBranchAndPathCoverage = $pathCoverage;
494503
} catch (CodeCoverageException $e) {
495504
EventFacade::emitter()->testRunnerTriggeredPhpunitWarning(
496505
$e->getMessage(),

src/Runner/Phpt/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function run(): void
195195

196196
(new Renderer)->renderForCoverage(
197197
$code,
198-
CodeCoverage::instance()->codeCoverage()->collectsBranchAndPathCoverage(),
198+
CodeCoverage::instance()->collectsBranchAndPathCoverage(),
199199
$codeCoverageCacheDirectory,
200200
$bootstrap,
201201
$this->coverageFiles(),

0 commit comments

Comments
 (0)