Skip to content

Commit

Permalink
Closes #5951
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Sep 18, 2024
1 parent d5e986f commit ee2a7c6
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ChangeLog-11.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ All notable changes of the PHPUnit 11.4 release series are documented in this fi
* The output of `--list-groups` now shows how many tests a group contains
* The output of `--list-suites` now shows how many tests a test suite contains

### Deprecated

* [#5951](https://github.com/sebastianbergmann/phpunit/issues/5951): `includeUncoveredFiles` configuration option

[11.4.0]: https://github.com/sebastianbergmann/phpunit/compare/11.3...main
1 change: 1 addition & 0 deletions DEPRECATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ This functionality is currently [hard-deprecated](https://phpunit.de/backward-co
| [#5214](https://github.com/sebastianbergmann/phpunit/issues/5214) | `TestCase::iniSet()` | 10.3.0 | |
| [#5216](https://github.com/sebastianbergmann/phpunit/issues/5216) | `TestCase::setLocale()` | 10.3.0 | |
| [#5800](https://github.com/sebastianbergmann/phpunit/issues/5800) | Targeting traits with `#[CoversClass]` and `#[UsesClass]` | 11.2.0 | `#[CoversClass]` and `#[UsesTrait]` |
| [#5951](https://github.com/sebastianbergmann/phpunit/issues/5951) | `includeUncoveredFiles` configuration option | 11.4.0 | |
1 change: 0 additions & 1 deletion phpunit.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
</xs:element>
</xs:all>
<xs:attribute name="pathCoverage" type="xs:boolean" default="false"/>
<xs:attribute name="includeUncoveredFiles" type="xs:boolean" default="true"/>
<xs:attribute name="ignoreDeprecatedCodeUnits" type="xs:boolean" default="false"/>
<xs:attribute name="disableCodeCoverageIgnore" type="xs:boolean" default="false"/>
</xs:complexType>
Expand Down
4 changes: 4 additions & 0 deletions src/TextUI/Configuration/Xml/Migration/MigrationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
RemoveCacheResultFileAttribute::class,
RemoveCoverageElementCacheDirectoryAttribute::class,
],

'11.4' => [
RemoveCoverageElementIncludeUncoveredFilesAttribute::class,
],
];

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* 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;

/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final readonly class RemoveCoverageElementIncludeUncoveredFilesAttribute 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('includeUncoveredFiles')) {
$node->removeAttribute('includeUncoveredFiles');
}
}
}
3 changes: 1 addition & 2 deletions tests/_files/XmlConfigurationMigration/output-9.2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd"
cacheDirectory=".phpunit.cache">

<coverage includeUncoveredFiles="true"
ignoreDeprecatedCodeUnits="true"
<coverage ignoreDeprecatedCodeUnits="true"
disableCodeCoverageIgnore="true">
<report>
<clover outputFile="clover.xml"/>
Expand Down

0 comments on commit ee2a7c6

Please sign in to comment.