Skip to content

Commit 4f62d10

Browse files
Revert "Implement --force-coverage-cache CLI option"
This reverts commit 4f7a13d.
1 parent c42c419 commit 4f62d10

File tree

13 files changed

+3
-70
lines changed

13 files changed

+3
-70
lines changed

ChangeLog-9.4.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ All notable changes of the PHPUnit 9.4 release series are documented in this fil
99
* [#4462](https://github.com/sebastianbergmann/phpunit/pull/4462): Support for Cobertura XML report format
1010
* [#4464](https://github.com/sebastianbergmann/phpunit/issues/4464): Filter based on covered (`@covers`) / used (`@uses`) units of code
1111
* [#4467](https://github.com/sebastianbergmann/phpunit/issues/4467): Convenient custom comparison of objects
12-
* Added `--force-coverage-cache` CLI option for configuring the code coverage static analysis cache to not check whether cache files exist and are up-to-date (do not use this if you do not need it or cannot guarantee that the cache files exist and are up-to-date)
1312

1413
### Changed
1514

src/Framework/TestCase.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,6 @@ public function run(TestResult $result = null): TestResult
811811
$codeCoverage = $result->getCodeCoverage();
812812
$codeCoverageFilter = null;
813813
$cachesStaticAnalysis = 'false';
814-
$forcesStaticAnalysisCache = 'false';
815814
$codeCoverageCacheDirectory = null;
816815
$driverMethod = 'forLineCoverage';
817816

@@ -825,10 +824,6 @@ public function run(TestResult $result = null): TestResult
825824
if ($codeCoverage->cachesStaticAnalysis()) {
826825
$cachesStaticAnalysis = 'true';
827826
$codeCoverageCacheDirectory = $codeCoverage->cacheDirectory();
828-
829-
if (!$codeCoverage->validatesStaticAnalysisCache()) {
830-
$forcesStaticAnalysisCache = 'true';
831-
}
832827
}
833828
}
834829

@@ -856,7 +851,6 @@ public function run(TestResult $result = null): TestResult
856851
'className' => $class->getName(),
857852
'collectCodeCoverageInformation' => $coverage,
858853
'cachesStaticAnalysis' => $cachesStaticAnalysis,
859-
'forcesStaticAnalysisCache' => $forcesStaticAnalysisCache,
860854
'codeCoverageCacheDirectory' => $codeCoverageCacheDirectory,
861855
'driverMethod' => $driverMethod,
862856
'data' => $data,

src/Runner/PhptTestCase.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,24 +173,19 @@ public function run(TestResult $result = null): TestResult
173173

174174
if ($result->getCollectCodeCoverageInformation()) {
175175
$codeCoverageCacheDirectory = null;
176-
$forcesStaticAnalysisCache = false;
177176
$pathCoverage = false;
178177

179178
$codeCoverage = $result->getCodeCoverage();
180179

181180
if ($codeCoverage) {
182181
if ($codeCoverage->cachesStaticAnalysis()) {
183182
$codeCoverageCacheDirectory = $codeCoverage->cacheDirectory();
184-
185-
if (!$codeCoverage->validatesStaticAnalysisCache()) {
186-
$forcesStaticAnalysisCache = true;
187-
}
188183
}
189184

190185
$pathCoverage = $codeCoverage->collectsBranchAndPathCoverage();
191186
}
192187

193-
$this->renderForCoverage($code, $pathCoverage, $codeCoverageCacheDirectory, $forcesStaticAnalysisCache);
188+
$this->renderForCoverage($code, $pathCoverage, $codeCoverageCacheDirectory);
194189
}
195190

196191
$timer = new Timer;
@@ -599,7 +594,7 @@ private function getCoverageFiles(): array
599594
];
600595
}
601596

602-
private function renderForCoverage(string &$job, bool $pathCoverage, ?string $codeCoverageCacheDirectory, bool $forcesStaticAnalysisCache): void
597+
private function renderForCoverage(string &$job, bool $pathCoverage, ?string $codeCoverageCacheDirectory): void
603598
{
604599
$files = $this->getCoverageFiles();
605600

@@ -643,7 +638,6 @@ private function renderForCoverage(string &$job, bool $pathCoverage, ?string $co
643638
'coverageFile' => $files['coverage'],
644639
'driverMethod' => $pathCoverage ? 'forLineAndPathCoverage' : 'forLineCoverage',
645640
'codeCoverageCacheDirectory' => $codeCoverageCacheDirectory,
646-
'forcesStaticAnalysisCache' => $forcesStaticAnalysisCache ? 'true' : 'false',
647641
]
648642
);
649643

src/TextUI/CliArguments/Builder.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ final class Builder
4141
'configuration=',
4242
'coverage-cache=',
4343
'warm-coverage-cache',
44-
'force-coverage-cache',
4544
'coverage-filter=',
4645
'coverage-clover=',
4746
'coverage-cobertura=',
@@ -154,7 +153,6 @@ public function fromParameters(array $parameters, array $additionalLongOptions):
154153
$configuration = null;
155154
$coverageCacheDirectory = null;
156155
$warmCoverageCache = null;
157-
$forceCoverageCache = null;
158156
$coverageFilter = null;
159157
$coverageClover = null;
160158
$coverageCobertura = null;
@@ -288,11 +286,6 @@ public function fromParameters(array $parameters, array $additionalLongOptions):
288286

289287
break;
290288

291-
case '--force-coverage-cache':
292-
$forceCoverageCache = true;
293-
294-
break;
295-
296289
case '--coverage-clover':
297290
$coverageClover = $option[1];
298291

@@ -821,7 +814,6 @@ public function fromParameters(array $parameters, array $additionalLongOptions):
821814
$pathCoverage,
822815
$coverageCacheDirectory,
823816
$warmCoverageCache,
824-
$forceCoverageCache,
825817
$debug,
826818
$defaultTimeLimit,
827819
$disableCodeCoverageIgnore,

src/TextUI/CliArguments/Configuration.php

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,6 @@ final class Configuration
147147
*/
148148
private $warmCoverageCache;
149149

150-
/**
151-
* @var ?bool
152-
*/
153-
private $forceCoverageCache;
154-
155150
/**
156151
* @var ?bool
157152
*/
@@ -480,7 +475,7 @@ final class Configuration
480475
/**
481476
* @param null|int|string $columns
482477
*/
483-
public function __construct(?string $argument, ?string $atLeastVersion, ?bool $backupGlobals, ?bool $backupStaticAttributes, ?bool $beStrictAboutChangesToGlobalState, ?bool $beStrictAboutResourceUsageDuringSmallTests, ?string $bootstrap, ?bool $cacheResult, ?string $cacheResultFile, ?bool $checkVersion, ?string $colors, $columns, ?string $configuration, ?string $coverageClover, ?string $coverageCobertura, ?string $coverageCrap4J, ?string $coverageHtml, ?string $coveragePhp, ?string $coverageText, ?bool $coverageTextShowUncoveredFiles, ?bool $coverageTextShowOnlySummary, ?string $coverageXml, ?bool $pathCoverage, ?string $coverageCacheDirectory, ?bool $warmCoverageCache, ?bool $forceCoverageCache, ?bool $debug, ?int $defaultTimeLimit, ?bool $disableCodeCoverageIgnore, ?bool $disallowTestOutput, ?bool $disallowTodoAnnotatedTests, ?bool $enforceTimeLimit, ?array $excludeGroups, ?int $executionOrder, ?int $executionOrderDefects, ?array $extensions, ?array $unavailableExtensions, ?bool $failOnEmptyTestSuite, ?bool $failOnIncomplete, ?bool $failOnRisky, ?bool $failOnSkipped, ?bool $failOnWarning, ?string $filter, ?bool $generateConfiguration, ?bool $migrateConfiguration, ?array $groups, ?array $testsCovering, ?array $testsUsing, ?bool $help, ?string $includePath, ?array $iniSettings, ?string $junitLogfile, ?bool $listGroups, ?bool $listSuites, ?bool $listTests, ?string $listTestsXml, ?string $loader, ?bool $noCoverage, ?bool $noExtensions, ?bool $noInteraction, ?bool $noLogging, ?string $printer, ?bool $processIsolation, ?int $randomOrderSeed, ?int $repeat, ?bool $reportUselessTests, ?bool $resolveDependencies, ?bool $reverseList, ?bool $stderr, ?bool $strictCoverage, ?bool $stopOnDefect, ?bool $stopOnError, ?bool $stopOnFailure, ?bool $stopOnIncomplete, ?bool $stopOnRisky, ?bool $stopOnSkipped, ?bool $stopOnWarning, ?string $teamcityLogfile, ?array $testdoxExcludeGroups, ?array $testdoxGroups, ?string $testdoxHtmlFile, ?string $testdoxTextFile, ?string $testdoxXmlFile, ?array $testSuffixes, ?string $testSuite, array $unrecognizedOptions, ?string $unrecognizedOrderBy, ?bool $useDefaultConfiguration, ?bool $verbose, ?bool $version, ?array $coverageFilter, ?string $xdebugFilterFile)
478+
public function __construct(?string $argument, ?string $atLeastVersion, ?bool $backupGlobals, ?bool $backupStaticAttributes, ?bool $beStrictAboutChangesToGlobalState, ?bool $beStrictAboutResourceUsageDuringSmallTests, ?string $bootstrap, ?bool $cacheResult, ?string $cacheResultFile, ?bool $checkVersion, ?string $colors, $columns, ?string $configuration, ?string $coverageClover, ?string $coverageCobertura, ?string $coverageCrap4J, ?string $coverageHtml, ?string $coveragePhp, ?string $coverageText, ?bool $coverageTextShowUncoveredFiles, ?bool $coverageTextShowOnlySummary, ?string $coverageXml, ?bool $pathCoverage, ?string $coverageCacheDirectory, ?bool $warmCoverageCache, ?bool $debug, ?int $defaultTimeLimit, ?bool $disableCodeCoverageIgnore, ?bool $disallowTestOutput, ?bool $disallowTodoAnnotatedTests, ?bool $enforceTimeLimit, ?array $excludeGroups, ?int $executionOrder, ?int $executionOrderDefects, ?array $extensions, ?array $unavailableExtensions, ?bool $failOnEmptyTestSuite, ?bool $failOnIncomplete, ?bool $failOnRisky, ?bool $failOnSkipped, ?bool $failOnWarning, ?string $filter, ?bool $generateConfiguration, ?bool $migrateConfiguration, ?array $groups, ?array $testsCovering, ?array $testsUsing, ?bool $help, ?string $includePath, ?array $iniSettings, ?string $junitLogfile, ?bool $listGroups, ?bool $listSuites, ?bool $listTests, ?string $listTestsXml, ?string $loader, ?bool $noCoverage, ?bool $noExtensions, ?bool $noInteraction, ?bool $noLogging, ?string $printer, ?bool $processIsolation, ?int $randomOrderSeed, ?int $repeat, ?bool $reportUselessTests, ?bool $resolveDependencies, ?bool $reverseList, ?bool $stderr, ?bool $strictCoverage, ?bool $stopOnDefect, ?bool $stopOnError, ?bool $stopOnFailure, ?bool $stopOnIncomplete, ?bool $stopOnRisky, ?bool $stopOnSkipped, ?bool $stopOnWarning, ?string $teamcityLogfile, ?array $testdoxExcludeGroups, ?array $testdoxGroups, ?string $testdoxHtmlFile, ?string $testdoxTextFile, ?string $testdoxXmlFile, ?array $testSuffixes, ?string $testSuite, array $unrecognizedOptions, ?string $unrecognizedOrderBy, ?bool $useDefaultConfiguration, ?bool $verbose, ?bool $version, ?array $coverageFilter, ?string $xdebugFilterFile)
484479
{
485480
$this->argument = $argument;
486481
$this->atLeastVersion = $atLeastVersion;
@@ -508,7 +503,6 @@ public function __construct(?string $argument, ?string $atLeastVersion, ?bool $b
508503
$this->pathCoverage = $pathCoverage;
509504
$this->coverageCacheDirectory = $coverageCacheDirectory;
510505
$this->warmCoverageCache = $warmCoverageCache;
511-
$this->forceCoverageCache = $forceCoverageCache;
512506
$this->debug = $debug;
513507
$this->defaultTimeLimit = $defaultTimeLimit;
514508
$this->disableCodeCoverageIgnore = $disableCodeCoverageIgnore;
@@ -1018,23 +1012,6 @@ public function warmCoverageCache(): bool
10181012
return $this->warmCoverageCache;
10191013
}
10201014

1021-
public function hasForceCoverageCache(): bool
1022-
{
1023-
return $this->forceCoverageCache !== null;
1024-
}
1025-
1026-
/**
1027-
* @throws Exception
1028-
*/
1029-
public function forceCoverageCache(): bool
1030-
{
1031-
if ($this->forceCoverageCache === null) {
1032-
throw new Exception;
1033-
}
1034-
1035-
return $this->forceCoverageCache;
1036-
}
1037-
10381015
public function hasDebug(): bool
10391016
{
10401017
return $this->debug !== null;

src/TextUI/CliArguments/Mapper.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ public function mapToLegacyArray(Configuration $arguments): array
6464
$result['warmCoverageCache'] = $arguments->warmCoverageCache();
6565
}
6666

67-
if ($arguments->hasForceCoverageCache()) {
68-
$result['forceCoverageCache'] = $arguments->forceCoverageCache();
69-
}
70-
7167
if ($arguments->hasCoverageClover()) {
7268
$result['coverageClover'] = $arguments->coverageClover();
7369
}

src/TextUI/Help.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ final class Help
4444
['arg' => '--coverage-xml <dir>', 'desc' => 'Generate code coverage report in PHPUnit XML format'],
4545
['arg' => '--coverage-cache <dir>', 'desc' => 'Cache static analysis results'],
4646
['arg' => '--warm-coverage-cache', 'desc' => 'Warm static analysis cache'],
47-
['arg' => '--force-coverage-cache', 'desc' => 'Do not validate static analysis cache'],
4847
['arg' => '--coverage-filter <dir>', 'desc' => 'Include <dir> in code coverage analysis'],
4948
['arg' => '--path-coverage', 'desc' => 'Perform path coverage analysis'],
5049
['arg' => '--disable-coverage-ignore', 'desc' => 'Disable annotations for ignoring code coverage'],

src/TextUI/TestRunner.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,6 @@ public function run(TestSuite $suite, array $arguments = [], array $warnings = [
473473
$codeCoverage->cacheStaticAnalysis($arguments['coverageCacheDirectory']);
474474
}
475475

476-
if (isset($arguments['forceCoverageCache']) && $arguments['forceCoverageCache'] === true && $codeCoverage->cachesStaticAnalysis()) {
477-
$codeCoverage->doNotValidateStaticAnalysisCache();
478-
}
479-
480476
$codeCoverage->excludeSubclassesOfThisClassFromUnintentionallyCoveredCodeCheck(Comparator::class);
481477

482478
if ($arguments['strictCoverage']) {

src/Util/PHP/Template/PhptTestCase.tpl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ if (class_exists('SebastianBergmann\CodeCoverage\CodeCoverage')) {
3535

3636
if ({codeCoverageCacheDirectory}) {
3737
$coverage->cacheStaticAnalysis({codeCoverageCacheDirectory});
38-
39-
if ({forcesStaticAnalysisCache}) {
40-
$coverage->doNotValidateStaticAnalysisCache();
41-
}
4238
}
4339

4440
$coverage->start(__FILE__);

src/Util/PHP/Template/TestCaseClass.tpl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ function __phpunit_run_isolated_test()
4545

4646
if ({cachesStaticAnalysis}) {
4747
$codeCoverage->cacheStaticAnalysis(unserialize('{codeCoverageCacheDirectory}'));
48-
49-
if ({forcesStaticAnalysisCache}) {
50-
$codeCoverage->doNotValidateStaticAnalysisCache();
51-
}
5248
}
5349

5450
$result->setCodeCoverage($codeCoverage);

src/Util/PHP/Template/TestCaseMethod.tpl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ function __phpunit_run_isolated_test()
4646

4747
if ({cachesStaticAnalysis}) {
4848
$codeCoverage->cacheStaticAnalysis(unserialize('{codeCoverageCacheDirectory}'));
49-
50-
if ({forcesStaticAnalysisCache}) {
51-
$codeCoverage->doNotValidateStaticAnalysisCache();
52-
}
5349
}
5450

5551
$result->setCodeCoverage($codeCoverage);

tests/end-to-end/cli/_files/output-cli-help-color.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
XML format
1919
--coverage-cache <dir>  Cache static analysis results
2020
--warm-coverage-cache  Warm static analysis cache
21-
--force-coverage-cache  Do not validate static analysis cache
2221
--coverage-filter <dir>  Include <dir> in code coverage analysis
2322
--path-coverage  Perform path coverage analysis
2423
--disable-coverage-ignore  Disable annotations for ignoring code

tests/end-to-end/cli/_files/output-cli-usage.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Code Coverage Options:
1515
--coverage-xml <dir> Generate code coverage report in PHPUnit XML format
1616
--coverage-cache <dir> Cache static analysis results
1717
--warm-coverage-cache Warm static analysis cache
18-
--force-coverage-cache Do not validate static analysis cache
1918
--coverage-filter <dir> Include <dir> in code coverage analysis
2019
--path-coverage Perform path coverage analysis
2120
--disable-coverage-ignore Disable annotations for ignoring code coverage

0 commit comments

Comments
 (0)