Skip to content

Commit

Permalink
Closes #5859
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jun 10, 2024
1 parent 103e228 commit 4c37cbd
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ChangeLog-11.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes of the PHPUnit 11.2 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.

## [11.2.1] - 2024-MM-DD

### Fixed

* [#5859](https://github.com/sebastianbergmann/phpunit/issues/5859): XML Configuration File Migrator does not remove `cacheDirectory` attribute from `<coverage>` element when migrating from PHPUnit 11.1 to PHPUnit 11.2

## [11.2.0] - 2024-06-07

### Added
Expand All @@ -14,4 +20,5 @@ All notable changes of the PHPUnit 11.2 release series are documented in this fi

* [#5800](https://github.com/sebastianbergmann/phpunit/issues/5800): Support for targeting traits with `#[CoversClass]` and `#[UsesClass]` attributes

[11.2.1]: https://github.com/sebastianbergmann/phpunit/compare/11.2.0...11.2
[11.2.0]: https://github.com/sebastianbergmann/phpunit/compare/11.1.3...11.2.0
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 @@ -69,6 +69,10 @@
'11.0' => [
ReplaceRestrictDeprecationsWithIgnoreDeprecations::class,
],

'11.1' => [
RemoveCoverageElementCacheDirectoryAttribute::class,
],
];

/**
Expand Down
5 changes: 5 additions & 0 deletions tests/_files/XmlConfigurationMigration/input-5859.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.2/phpunit.xsd">
<coverage cacheDirectory="var/.coverage-cache"/>
</phpunit>
5 changes: 5 additions & 0 deletions tests/_files/XmlConfigurationMigration/output-5859.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.2/phpunit.xsd">
<coverage/>
</phpunit>
15 changes: 15 additions & 0 deletions tests/unit/TextUI/Configuration/Xml/MigratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace PHPUnit\TextUI\XmlConfiguration;

use PHPUnit\Framework\Attributes\TestDox;
use PHPUnit\Framework\Attributes\Ticket;
use PHPUnit\Framework\TestCase;
use PHPUnit\Util\Xml\Loader as XmlLoader;

Expand Down Expand Up @@ -40,4 +41,18 @@ public function testCanMigratePhpUnit95Configuration(): void
),
);
}

#[TestDox('Remove cacheDirectory attribute from <coverage> element when migrating from PHPUnit 11.1 to PHPUnit 11.2')]
#[Ticket('https://github.com/sebastianbergmann/phpunit/issues/5859')]
public function testIssue5859(): void
{
$this->assertEquals(
(new XmlLoader)->loadFile(__DIR__ . '/../../../../_files/XmlConfigurationMigration/output-5859.xml'),
(new XmlLoader)->load(
(new Migrator)->migrate(
__DIR__ . '/../../../../_files/XmlConfigurationMigration/input-5859.xml',
),
),
);
}
}

0 comments on commit 4c37cbd

Please sign in to comment.