Skip to content

Commit 4c37cbd

Browse files
Closes #5859
1 parent 103e228 commit 4c37cbd

File tree

5 files changed

+36
-0
lines changed

5 files changed

+36
-0
lines changed

ChangeLog-11.2.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

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

5+
## [11.2.1] - 2024-MM-DD
6+
7+
### Fixed
8+
9+
* [#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
10+
511
## [11.2.0] - 2024-06-07
612

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

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

23+
[11.2.1]: https://github.com/sebastianbergmann/phpunit/compare/11.2.0...11.2
1724
[11.2.0]: https://github.com/sebastianbergmann/phpunit/compare/11.1.3...11.2.0

src/TextUI/Configuration/Xml/Migration/MigrationBuilder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@
6969
'11.0' => [
7070
ReplaceRestrictDeprecationsWithIgnoreDeprecations::class,
7171
],
72+
73+
'11.1' => [
74+
RemoveCoverageElementCacheDirectoryAttribute::class,
75+
],
7276
];
7377

7478
/**
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.2/phpunit.xsd">
4+
<coverage cacheDirectory="var/.coverage-cache"/>
5+
</phpunit>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.2/phpunit.xsd">
4+
<coverage/>
5+
</phpunit>

tests/unit/TextUI/Configuration/Xml/MigratorTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace PHPUnit\TextUI\XmlConfiguration;
1111

1212
use PHPUnit\Framework\Attributes\TestDox;
13+
use PHPUnit\Framework\Attributes\Ticket;
1314
use PHPUnit\Framework\TestCase;
1415
use PHPUnit\Util\Xml\Loader as XmlLoader;
1516

@@ -40,4 +41,18 @@ public function testCanMigratePhpUnit95Configuration(): void
4041
),
4142
);
4243
}
44+
45+
#[TestDox('Remove cacheDirectory attribute from <coverage> element when migrating from PHPUnit 11.1 to PHPUnit 11.2')]
46+
#[Ticket('https://github.com/sebastianbergmann/phpunit/issues/5859')]
47+
public function testIssue5859(): void
48+
{
49+
$this->assertEquals(
50+
(new XmlLoader)->loadFile(__DIR__ . '/../../../../_files/XmlConfigurationMigration/output-5859.xml'),
51+
(new XmlLoader)->load(
52+
(new Migrator)->migrate(
53+
__DIR__ . '/../../../../_files/XmlConfigurationMigration/input-5859.xml',
54+
),
55+
),
56+
);
57+
}
4358
}

0 commit comments

Comments
 (0)