Skip to content

Commit

Permalink
Closes #5952
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Oct 7, 2024
1 parent cc9dfca commit 1964ae3
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 36 deletions.
1 change: 1 addition & 0 deletions ChangeLog-12.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ All notable changes of the PHPUnit 12.0 release series are documented in this fi
* [#5424](https://github.com/sebastianbergmann/phpunit/issues/5424): `TestCase` methods for creating return stub configuration objects
* [#5473](https://github.com/sebastianbergmann/phpunit/issues/5473): `assertStringNotMatchesFormat()` and `assertStringNotMatchesFormatFile()`
* [#5710](https://github.com/sebastianbergmann/phpunit/issues/5710): Support for using comma-separated values with the `--group`, `--exclude-group`, `--covers`, `--uses`, and `--test-suffix` CLI options
* [#5952](https://github.com/sebastianbergmann/phpunit/issues/5952): `includeUncoveredFiles` configuration option
* [#5978](https://github.com/sebastianbergmann/phpunit/issues/5978): Support for PHP 8.2

[12.0.0]: https://github.com/sebastianbergmann/phpunit/compare/11.5...main
1 change: 0 additions & 1 deletion DEPRECATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ This functionality is currently [hard-deprecated](https://phpunit.de/backward-co
|-------------------------------------------------------------------|-------------------------------------------------------------|--------|-----------------------------------------------------------------------------------------|
| [#4505](https://github.com/sebastianbergmann/phpunit/issues/4505) | Metadata in doc-comments | 10.3.0 | Metadata in attributes |
| [#5800](https://github.com/sebastianbergmann/phpunit/issues/5800) | Targeting traits with `#[CoversClass]` and `#[UsesClass]` | 11.2.0 | `#[CoversClass]` and `#[UsesClass]` also target the traits used by the targeted classes |
| [#5951](https://github.com/sebastianbergmann/phpunit/issues/5951) | `includeUncoveredFiles` configuration option | 11.4.0 | |
| [#5958](https://github.com/sebastianbergmann/phpunit/issues/5958) | `#[CoversTrait]` and `#[UsesTrait]` attributes | 11.4.0 | `#[CoversClass]` and `#[UsesClass]` also target the traits used by the targeted classes |
| [#5960](https://github.com/sebastianbergmann/phpunit/issues/5960) | Targeting traits with `#[CoversMethod]` and `#[UsesMethod]` | 11.4.0 | |
6 changes: 0 additions & 6 deletions src/Runner/CodeCoverage.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,6 @@ public function init(Configuration $configuration, CodeCoverageFilterRegistry $c
$this->codeCoverage()->enableAnnotationsForIgnoringCode();
}

if ($configuration->includeUncoveredFiles()) {
$this->codeCoverage()->includeUncoveredFiles();
} else {
$this->codeCoverage()->excludeUncoveredFiles();
}

if ($codeCoverageFilterRegistry->get()->isEmpty()) {
if (!$codeCoverageFilterRegistry->configured()) {
EventFacade::emitter()->testRunnerTriggeredWarning(
Expand Down
9 changes: 1 addition & 8 deletions src/TextUI/Configuration/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@
*/
private ?array $excludeGroups;
private int $randomOrderSeed;
private bool $includeUncoveredFiles;
private TestSuiteCollection $testSuite;
private string $includeTestSuite;
private string $excludeTestSuite;
Expand Down Expand Up @@ -181,7 +180,7 @@
* @param non-empty-list<non-empty-string> $testSuffixes
* @param non-negative-int $shortenArraysForExportThreshold
*/
public function __construct(array $cliArguments, ?string $configurationFile, ?string $bootstrap, bool $cacheResult, ?string $cacheDirectory, ?string $coverageCacheDirectory, Source $source, string $testResultCacheFile, ?string $coverageClover, ?string $coverageCobertura, ?string $coverageCrap4j, int $coverageCrap4jThreshold, ?string $coverageHtml, int $coverageHtmlLowUpperBound, int $coverageHtmlHighLowerBound, string $coverageHtmlColorSuccessLow, string $coverageHtmlColorSuccessMedium, string $coverageHtmlColorSuccessHigh, string $coverageHtmlColorWarning, string $coverageHtmlColorDanger, ?string $coverageHtmlCustomCssFile, ?string $coveragePhp, ?string $coverageText, bool $coverageTextShowUncoveredFiles, bool $coverageTextShowOnlySummary, ?string $coverageXml, bool $pathCoverage, bool $ignoreDeprecatedCodeUnitsFromCodeCoverage, bool $disableCodeCoverageIgnore, bool $failOnDeprecation, bool $failOnPhpunitDeprecation, bool $failOnEmptyTestSuite, bool $failOnIncomplete, bool $failOnNotice, bool $failOnRisky, bool $failOnSkipped, bool $failOnWarning, bool $stopOnDefect, bool $stopOnDeprecation, bool $stopOnError, bool $stopOnFailure, bool $stopOnIncomplete, bool $stopOnNotice, bool $stopOnRisky, bool $stopOnSkipped, bool $stopOnWarning, bool $outputToStandardErrorStream, int|string $columns, bool $noExtensions, ?string $pharExtensionDirectory, array $extensionBootstrappers, bool $backupGlobals, bool $backupStaticProperties, bool $beStrictAboutChangesToGlobalState, bool $colors, bool $processIsolation, bool $enforceTimeLimit, int $defaultTimeLimit, int $timeoutForSmallTests, int $timeoutForMediumTests, int $timeoutForLargeTests, bool $reportUselessTests, bool $strictCoverage, bool $disallowTestOutput, bool $displayDetailsOnIncompleteTests, bool $displayDetailsOnSkippedTests, bool $displayDetailsOnTestsThatTriggerDeprecations, bool $displayDetailsOnPhpunitDeprecations, bool $displayDetailsOnTestsThatTriggerErrors, bool $displayDetailsOnTestsThatTriggerNotices, bool $displayDetailsOnTestsThatTriggerWarnings, bool $reverseDefectList, bool $requireCoverageMetadata, bool $noProgress, bool $noResults, bool $noOutput, int $executionOrder, int $executionOrderDefects, bool $resolveDependencies, ?string $logfileTeamcity, ?string $logfileJunit, ?string $logfileTestdoxHtml, ?string $logfileTestdoxText, ?string $logEventsText, ?string $logEventsVerboseText, bool $teamCityOutput, bool $testDoxOutput, bool $testDoxOutputSummary, ?array $testsCovering, ?array $testsUsing, ?array $testsRequiringPhpExtension, ?string $filter, ?string $excludeFilter, array $groups, array $excludeGroups, int $randomOrderSeed, bool $includeUncoveredFiles, TestSuiteCollection $testSuite, string $includeTestSuite, string $excludeTestSuite, ?string $defaultTestSuite, array $testSuffixes, Php $php, bool $controlGarbageCollector, int $numberOfTestsBeforeGarbageCollection, ?string $generateBaseline, bool $debug, int $shortenArraysForExportThreshold)
public function __construct(array $cliArguments, ?string $configurationFile, ?string $bootstrap, bool $cacheResult, ?string $cacheDirectory, ?string $coverageCacheDirectory, Source $source, string $testResultCacheFile, ?string $coverageClover, ?string $coverageCobertura, ?string $coverageCrap4j, int $coverageCrap4jThreshold, ?string $coverageHtml, int $coverageHtmlLowUpperBound, int $coverageHtmlHighLowerBound, string $coverageHtmlColorSuccessLow, string $coverageHtmlColorSuccessMedium, string $coverageHtmlColorSuccessHigh, string $coverageHtmlColorWarning, string $coverageHtmlColorDanger, ?string $coverageHtmlCustomCssFile, ?string $coveragePhp, ?string $coverageText, bool $coverageTextShowUncoveredFiles, bool $coverageTextShowOnlySummary, ?string $coverageXml, bool $pathCoverage, bool $ignoreDeprecatedCodeUnitsFromCodeCoverage, bool $disableCodeCoverageIgnore, bool $failOnDeprecation, bool $failOnPhpunitDeprecation, bool $failOnEmptyTestSuite, bool $failOnIncomplete, bool $failOnNotice, bool $failOnRisky, bool $failOnSkipped, bool $failOnWarning, bool $stopOnDefect, bool $stopOnDeprecation, bool $stopOnError, bool $stopOnFailure, bool $stopOnIncomplete, bool $stopOnNotice, bool $stopOnRisky, bool $stopOnSkipped, bool $stopOnWarning, bool $outputToStandardErrorStream, int|string $columns, bool $noExtensions, ?string $pharExtensionDirectory, array $extensionBootstrappers, bool $backupGlobals, bool $backupStaticProperties, bool $beStrictAboutChangesToGlobalState, bool $colors, bool $processIsolation, bool $enforceTimeLimit, int $defaultTimeLimit, int $timeoutForSmallTests, int $timeoutForMediumTests, int $timeoutForLargeTests, bool $reportUselessTests, bool $strictCoverage, bool $disallowTestOutput, bool $displayDetailsOnIncompleteTests, bool $displayDetailsOnSkippedTests, bool $displayDetailsOnTestsThatTriggerDeprecations, bool $displayDetailsOnPhpunitDeprecations, bool $displayDetailsOnTestsThatTriggerErrors, bool $displayDetailsOnTestsThatTriggerNotices, bool $displayDetailsOnTestsThatTriggerWarnings, bool $reverseDefectList, bool $requireCoverageMetadata, bool $noProgress, bool $noResults, bool $noOutput, int $executionOrder, int $executionOrderDefects, bool $resolveDependencies, ?string $logfileTeamcity, ?string $logfileJunit, ?string $logfileTestdoxHtml, ?string $logfileTestdoxText, ?string $logEventsText, ?string $logEventsVerboseText, bool $teamCityOutput, bool $testDoxOutput, bool $testDoxOutputSummary, ?array $testsCovering, ?array $testsUsing, ?array $testsRequiringPhpExtension, ?string $filter, ?string $excludeFilter, array $groups, array $excludeGroups, int $randomOrderSeed, TestSuiteCollection $testSuite, string $includeTestSuite, string $excludeTestSuite, ?string $defaultTestSuite, array $testSuffixes, Php $php, bool $controlGarbageCollector, int $numberOfTestsBeforeGarbageCollection, ?string $generateBaseline, bool $debug, int $shortenArraysForExportThreshold)
{
$this->cliArguments = $cliArguments;
$this->configurationFile = $configurationFile;
Expand Down Expand Up @@ -279,7 +278,6 @@ public function __construct(array $cliArguments, ?string $configurationFile, ?st
$this->groups = $groups;
$this->excludeGroups = $excludeGroups;
$this->randomOrderSeed = $randomOrderSeed;
$this->includeUncoveredFiles = $includeUncoveredFiles;
$this->testSuite = $testSuite;
$this->includeTestSuite = $includeTestSuite;
$this->excludeTestSuite = $excludeTestSuite;
Expand Down Expand Up @@ -1200,11 +1198,6 @@ public function randomOrderSeed(): int
return $this->randomOrderSeed;
}

public function includeUncoveredFiles(): bool
{
return $this->includeUncoveredFiles;
}

public function testSuite(): TestSuiteCollection
{
return $this->testSuite;
Expand Down
3 changes: 0 additions & 3 deletions src/TextUI/Configuration/Merger.php
Original file line number Diff line number Diff line change
Expand Up @@ -665,8 +665,6 @@ public function merge(CliConfiguration $cliConfiguration, XmlConfiguration $xmlC
}
}

$includeUncoveredFiles = $xmlConfiguration->codeCoverage()->includeUncoveredFiles();

$includePaths = [];

if ($cliConfiguration->hasIncludePath()) {
Expand Down Expand Up @@ -885,7 +883,6 @@ public function merge(CliConfiguration $cliConfiguration, XmlConfiguration $xmlC
$groups,
$excludeGroups,
$randomOrderSeed,
$includeUncoveredFiles,
$xmlConfiguration->testSuite(),
$includeTestSuite,
$excludeTestSuite,
Expand Down
9 changes: 1 addition & 8 deletions src/TextUI/Configuration/Xml/CodeCoverage/CodeCoverage.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
final readonly class CodeCoverage
{
private bool $pathCoverage;
private bool $includeUncoveredFiles;
private bool $ignoreDeprecatedCodeUnits;
private bool $disableCodeCoverageIgnore;
private ?Clover $clover;
Expand All @@ -39,10 +38,9 @@
private ?Text $text;
private ?Xml $xml;

public function __construct(bool $pathCoverage, bool $includeUncoveredFiles, bool $ignoreDeprecatedCodeUnits, bool $disableCodeCoverageIgnore, ?Clover $clover, ?Cobertura $cobertura, ?Crap4j $crap4j, ?Html $html, ?Php $php, ?Text $text, ?Xml $xml)
public function __construct(bool $pathCoverage, bool $ignoreDeprecatedCodeUnits, bool $disableCodeCoverageIgnore, ?Clover $clover, ?Cobertura $cobertura, ?Crap4j $crap4j, ?Html $html, ?Php $php, ?Text $text, ?Xml $xml)
{
$this->pathCoverage = $pathCoverage;
$this->includeUncoveredFiles = $includeUncoveredFiles;
$this->ignoreDeprecatedCodeUnits = $ignoreDeprecatedCodeUnits;
$this->disableCodeCoverageIgnore = $disableCodeCoverageIgnore;
$this->clover = $clover;
Expand All @@ -59,11 +57,6 @@ public function pathCoverage(): bool
return $this->pathCoverage;
}

public function includeUncoveredFiles(): bool
{
return $this->includeUncoveredFiles;
}

public function ignoreDeprecatedCodeUnits(): bool
{
return $this->ignoreDeprecatedCodeUnits;
Expand Down
1 change: 0 additions & 1 deletion src/TextUI/Configuration/Xml/DefaultConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public static function create(): self
),
new CodeCoverage(
false,
true,
false,
false,
null,
Expand Down
8 changes: 0 additions & 8 deletions src/TextUI/Configuration/Xml/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ private function source(string $filename, DOMXPath $xpath): Source
private function codeCoverage(string $filename, DOMXPath $xpath): CodeCoverage
{
$pathCoverage = false;
$includeUncoveredFiles = true;
$ignoreDeprecatedCodeUnits = false;
$disableCodeCoverageIgnore = false;

Expand All @@ -367,12 +366,6 @@ private function codeCoverage(string $filename, DOMXPath $xpath): CodeCoverage
false,
);

$includeUncoveredFiles = $this->getBooleanAttribute(
$element,
'includeUncoveredFiles',
true,
);

$ignoreDeprecatedCodeUnits = $this->getBooleanAttribute(
$element,
'ignoreDeprecatedCodeUnits',
Expand Down Expand Up @@ -500,7 +493,6 @@ private function codeCoverage(string $filename, DOMXPath $xpath): CodeCoverage

return new CodeCoverage(
$pathCoverage,
$includeUncoveredFiles,
$ignoreDeprecatedCodeUnits,
$disableCodeCoverageIgnore,
$clover,
Expand Down
1 change: 0 additions & 1 deletion tests/unit/TextUI/Configuration/Xml/LoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ public function testCodeCoverageConfigurationIsReadCorrectly(): void
$codeCoverage = $this->configuration('configuration_codecoverage.xml')->codeCoverage();

$this->assertTrue($codeCoverage->pathCoverage());
$this->assertTrue($codeCoverage->includeUncoveredFiles());
$this->assertTrue($codeCoverage->ignoreDeprecatedCodeUnits());
$this->assertTrue($codeCoverage->disableCodeCoverageIgnore());

Expand Down

0 comments on commit 1964ae3

Please sign in to comment.