diff --git a/ChangeLog-10.0.md b/ChangeLog-10.0.md index 10b6a2ef482..f7247ac9c37 100644 --- a/ChangeLog-10.0.md +++ b/ChangeLog-10.0.md @@ -52,6 +52,7 @@ All notable changes of the PHPUnit 10.0 release series are documented in this fi * [#4601](https://github.com/sebastianbergmann/phpunit/issues/4601): Deprecate assertions that operate on class/object properties * Removed the `PHPUnit\Runner\TestSuiteLoader` interface * Removed the `` XML configuration element and its children -* Removed the `groups` attribute on the `test` element in the TestDox XML report +* Removed the `groups` attribute on the `` element in the TestDox XML report +* Removed the `processUncoveredFiles` attribute on the `` XML configuration element [10.0.0]: https://github.com/sebastianbergmann/phpunit/compare/9.5...master diff --git a/phpunit.xml b/phpunit.xml index e494cb41342..295b8f3ae39 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -18,8 +18,7 @@ - + src diff --git a/phpunit.xsd b/phpunit.xsd index f642195f271..5f7b968702c 100644 --- a/phpunit.xsd +++ b/phpunit.xsd @@ -32,7 +32,6 @@ - diff --git a/src/TextUI/TestRunner.php b/src/TextUI/TestRunner.php index 65025adf110..be616c31520 100644 --- a/src/TextUI/TestRunner.php +++ b/src/TextUI/TestRunner.php @@ -466,12 +466,6 @@ public function run(TestSuite $suite, array $arguments = [], array $warnings = [ } else { CodeCoverage::instance()->excludeUncoveredFiles(); } - - if ($codeCoverageConfiguration->processUncoveredFiles()) { - CodeCoverage::instance()->processUncoveredFiles(); - } else { - CodeCoverage::instance()->doNotProcessUncoveredFiles(); - } } } diff --git a/src/TextUI/XmlConfiguration/CodeCoverage/CodeCoverage.php b/src/TextUI/XmlConfiguration/CodeCoverage/CodeCoverage.php index 4f67c1a929d..a80e8df9251 100644 --- a/src/TextUI/XmlConfiguration/CodeCoverage/CodeCoverage.php +++ b/src/TextUI/XmlConfiguration/CodeCoverage/CodeCoverage.php @@ -42,8 +42,6 @@ final class CodeCoverage private bool $includeUncoveredFiles; - private bool $processUncoveredFiles; - private bool $ignoreDeprecatedCodeUnits; private bool $disableCodeCoverageIgnore; @@ -62,7 +60,7 @@ final class CodeCoverage private ?Xml $xml = null; - public function __construct(?Directory $cacheDirectory, DirectoryCollection $directories, FileCollection $files, DirectoryCollection $excludeDirectories, FileCollection $excludeFiles, bool $pathCoverage, bool $includeUncoveredFiles, bool $processUncoveredFiles, bool $ignoreDeprecatedCodeUnits, bool $disableCodeCoverageIgnore, ?Clover $clover, ?Cobertura $cobertura, ?Crap4j $crap4j, ?Html $html, ?Php $php, ?Text $text, ?Xml $xml) + public function __construct(?Directory $cacheDirectory, DirectoryCollection $directories, FileCollection $files, DirectoryCollection $excludeDirectories, FileCollection $excludeFiles, bool $pathCoverage, bool $includeUncoveredFiles, bool $ignoreDeprecatedCodeUnits, bool $disableCodeCoverageIgnore, ?Clover $clover, ?Cobertura $cobertura, ?Crap4j $crap4j, ?Html $html, ?Php $php, ?Text $text, ?Xml $xml) { $this->cacheDirectory = $cacheDirectory; $this->directories = $directories; @@ -71,7 +69,6 @@ public function __construct(?Directory $cacheDirectory, DirectoryCollection $dir $this->excludeFiles = $excludeFiles; $this->pathCoverage = $pathCoverage; $this->includeUncoveredFiles = $includeUncoveredFiles; - $this->processUncoveredFiles = $processUncoveredFiles; $this->ignoreDeprecatedCodeUnits = $ignoreDeprecatedCodeUnits; $this->disableCodeCoverageIgnore = $disableCodeCoverageIgnore; $this->clover = $clover; @@ -154,11 +151,6 @@ public function disableCodeCoverageIgnore(): bool return $this->disableCodeCoverageIgnore; } - public function processUncoveredFiles(): bool - { - return $this->processUncoveredFiles; - } - /** * @psalm-assert-if-true !null $this->clover */ diff --git a/src/TextUI/XmlConfiguration/Generator.php b/src/TextUI/XmlConfiguration/Generator.php index b8eb8444736..7c3549e6360 100644 --- a/src/TextUI/XmlConfiguration/Generator.php +++ b/src/TextUI/XmlConfiguration/Generator.php @@ -39,7 +39,7 @@ final class Generator - + {src_directory} diff --git a/src/TextUI/XmlConfiguration/Loader.php b/src/TextUI/XmlConfiguration/Loader.php index 2a789c9ba43..910870c458e 100644 --- a/src/TextUI/XmlConfiguration/Loader.php +++ b/src/TextUI/XmlConfiguration/Loader.php @@ -306,7 +306,6 @@ private function codeCoverage(string $filename, DOMXPath $xpath, DOMDocument $do $cacheDirectory = null; $pathCoverage = false; $includeUncoveredFiles = true; - $processUncoveredFiles = false; $ignoreDeprecatedCodeUnits = false; $disableCodeCoverageIgnore = false; @@ -333,12 +332,6 @@ private function codeCoverage(string $filename, DOMXPath $xpath, DOMDocument $do true ); - $processUncoveredFiles = $this->getBooleanAttribute( - $element, - 'processUncoveredFiles', - false - ); - $ignoreDeprecatedCodeUnits = $this->getBooleanAttribute( $element, 'ignoreDeprecatedCodeUnits', @@ -463,7 +456,6 @@ private function codeCoverage(string $filename, DOMXPath $xpath, DOMDocument $do $this->readFilterFiles($filename, $xpath, 'coverage/exclude/file'), $pathCoverage, $includeUncoveredFiles, - $processUncoveredFiles, $ignoreDeprecatedCodeUnits, $disableCodeCoverageIgnore, $clover, diff --git a/src/TextUI/XmlConfiguration/Migration/MigrationBuilder.php b/src/TextUI/XmlConfiguration/Migration/MigrationBuilder.php index 139ff273ef7..8f8b357c1ed 100644 --- a/src/TextUI/XmlConfiguration/Migration/MigrationBuilder.php +++ b/src/TextUI/XmlConfiguration/Migration/MigrationBuilder.php @@ -45,6 +45,7 @@ final class MigrationBuilder RemoveTestSuiteLoaderAttributes::class, RemoveCacheResultFileAttribute::class, RemoveCoverageElementCacheDirectoryAttribute::class, + RemoveCoverageElementProcessUncoveredFilesAttribute::class, IntroduceCacheDirectoryAttribute::class, RenameBackupStaticAttributesAttribute::class, ], diff --git a/src/TextUI/XmlConfiguration/Migration/Migrations/RemoveCoverageElementProcessUncoveredFilesAttribute.php b/src/TextUI/XmlConfiguration/Migration/Migrations/RemoveCoverageElementProcessUncoveredFilesAttribute.php new file mode 100644 index 00000000000..7a55eacf632 --- /dev/null +++ b/src/TextUI/XmlConfiguration/Migration/Migrations/RemoveCoverageElementProcessUncoveredFilesAttribute.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; + +use DOMDocument; +use DOMElement; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class RemoveCoverageElementProcessUncoveredFilesAttribute implements Migration +{ + public function migrate(DOMDocument $document): void + { + $node = $document->getElementsByTagName('coverage')->item(0); + + if (!$node instanceof DOMElement || $node->parentNode === null) { + return; + } + + if ($node->hasAttribute('processUncoveredFiles')) { + $node->removeAttribute('processUncoveredFiles'); + } + } +} diff --git a/tests/_files/XmlConfigurationMigration/output-9.2.xml b/tests/_files/XmlConfigurationMigration/output-9.2.xml index 23bf4d5b1c8..0d9b7236c92 100644 --- a/tests/_files/XmlConfigurationMigration/output-9.2.xml +++ b/tests/_files/XmlConfigurationMigration/output-9.2.xml @@ -4,7 +4,6 @@ cacheDirectory=".phpunit.cache"> diff --git a/tests/_files/XmlConfigurationMigration/output-9.5.xml b/tests/_files/XmlConfigurationMigration/output-9.5.xml index 4b9fdbdc7d3..40e28456015 100644 --- a/tests/_files/XmlConfigurationMigration/output-9.5.xml +++ b/tests/_files/XmlConfigurationMigration/output-9.5.xml @@ -3,7 +3,7 @@ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache"> - + src diff --git a/tests/end-to-end/force-covers-annotation/phpunit.xml b/tests/end-to-end/force-covers-annotation/phpunit.xml index 22c08ed6b00..f823bf7268d 100644 --- a/tests/end-to-end/force-covers-annotation/phpunit.xml +++ b/tests/end-to-end/force-covers-annotation/phpunit.xml @@ -8,7 +8,7 @@ - + src diff --git a/tests/end-to-end/risky-tests/global-state/phpunit.xml b/tests/end-to-end/risky-tests/global-state/phpunit.xml index d67f7e95eb7..00e7f20f78a 100644 --- a/tests/end-to-end/risky-tests/global-state/phpunit.xml +++ b/tests/end-to-end/risky-tests/global-state/phpunit.xml @@ -17,7 +17,7 @@ - + src diff --git a/tests/unit/TextUI/XmlConfigurationGeneratorTest.php b/tests/unit/TextUI/XmlConfigurationGeneratorTest.php index 21121de85a8..ea9b91c7618 100644 --- a/tests/unit/TextUI/XmlConfigurationGeneratorTest.php +++ b/tests/unit/TextUI/XmlConfigurationGeneratorTest.php @@ -41,7 +41,7 @@ public function testGeneratesConfigurationCorrectly(): void - + src diff --git a/tests/unit/TextUI/XmlConfigurationTest.php b/tests/unit/TextUI/XmlConfigurationTest.php index 94fe9d42f80..2ed4e7b6767 100644 --- a/tests/unit/TextUI/XmlConfigurationTest.php +++ b/tests/unit/TextUI/XmlConfigurationTest.php @@ -158,7 +158,6 @@ public function testCodeCoverageConfigurationIsReadCorrectly(): void $this->assertTrue($codeCoverage->pathCoverage()); $this->assertTrue($codeCoverage->includeUncoveredFiles()); - $this->assertTrue($codeCoverage->processUncoveredFiles()); $this->assertTrue($codeCoverage->ignoreDeprecatedCodeUnits()); $this->assertTrue($codeCoverage->disableCodeCoverageIgnore());