Skip to content

Commit

Permalink
Closes #5405
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jun 11, 2023
1 parent 70e8497 commit 324512e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions ChangeLog-9.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes of the PHPUnit 9.6 release series are documented in this fil

### Fixed

* [#5405](https://github.com/sebastianbergmann/phpunit/issues/5405): XML configuration migration does not migrate `whitelist/file` elements
* Always use `X.Y.Z` version number (and not just `X.Y`) of PHPUnit's version when checking whether a PHAR-distributed extension is compatible

## [9.6.8] - 2023-05-11
Expand Down
2 changes: 1 addition & 1 deletion src/TextUI/XmlConfiguration/Migration/MigrationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class MigrationBuilder
IntroduceCoverageElement::class,
MoveAttributesFromRootToCoverage::class,
MoveAttributesFromFilterWhitelistToCoverage::class,
MoveWhitelistDirectoriesToCoverage::class,
MoveWhitelistIncludesToCoverage::class,
MoveWhitelistExcludesToCoverage::class,
RemoveEmptyFilter::class,
CoverageCloverToReport::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class MoveWhitelistDirectoriesToCoverage implements Migration
final class MoveWhitelistIncludesToCoverage implements Migration
{
/**
* @throws MigrationException
Expand All @@ -39,7 +39,11 @@ public function migrate(DOMDocument $document): void
$coverage->appendChild($include);

foreach (SnapshotNodeList::fromNodeList($whitelist->childNodes) as $child) {
if (!$child instanceof DOMElement || $child->nodeName !== 'directory') {
if (!$child instanceof DOMElement) {
continue;
}

if (!($child->nodeName === 'directory' || $child->nodeName === 'file')) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
<file>file.php</file>
</whitelist>
</filter>
</phpunit>

0 comments on commit 324512e

Please sign in to comment.