Skip to content

Commit

Permalink
Merge branch '10.5' into 11.5
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 20, 2024
2 parents 6ca2c7c + e4e732d commit 15f34af
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 47 deletions.
1 change: 1 addition & 0 deletions ChangeLog-11.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes of the PHPUnit 11.5 release series are documented in this fi
### Fixed

* [#6082](https://github.com/sebastianbergmann/phpunit/issues/6082): `assertArrayHasKey()`, `assertArrayNotHasKey()`, `arrayHasKey()`, and `ArrayHasKey::__construct()` do not support all possible key types
* [#6087](https://github.com/sebastianbergmann/phpunit/issues/6087): `--migrate-configuration` does not remove `beStrictAboutTodoAnnotatedTests` attribute from XML configuration file

## [11.5.1] - 2024-12-11

Expand Down
8 changes: 8 additions & 0 deletions src/TextUI/Configuration/Xml/Migration/MigrationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
MoveCoverageDirectoriesToSource::class,
],

'10.4' => [
RemoveBeStrictAboutTodoAnnotatedTestsAttribute::class,
],

'10.5' => [
RemoveRegisterMockObjectsFromTestArgumentsRecursivelyAttribute::class,
],
Expand All @@ -77,6 +81,10 @@
RemoveCoverageElementCacheDirectoryAttribute::class,
],

'11.2' => [
RemoveBeStrictAboutTodoAnnotatedTestsAttribute::class,
],

'11.4' => [
RemoveCoverageElementIncludeUncoveredFilesAttribute::class,
],
Expand Down
11 changes: 11 additions & 0 deletions tests/_files/XmlConfigurationMigration/input-issue-6087.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.1/phpunit.xsd"
beStrictAboutTodoAnnotatedTests="true"
>
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
10 changes: 10 additions & 0 deletions tests/_files/XmlConfigurationMigration/output-issue-6087.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
>
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
75 changes: 28 additions & 47 deletions tests/unit/TextUI/Configuration/Xml/MigratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,63 +9,44 @@
*/
namespace PHPUnit\TextUI\XmlConfiguration;

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

final class MigratorTest extends TestCase
{
#[TestDox('Can migrate PHPUnit 9.2 configuration')]
public function testCanMigratePhpUnit92Configuration(): void
public static function provider(): array
{
$this->assertEquals(
(new XmlLoader)->loadFile(__DIR__ . '/../../../../_files/XmlConfigurationMigration/output-9.2.xml'),
(new XmlLoader)->load(
(new Migrator)->migrate(
__DIR__ . '/../../../../_files/XmlConfigurationMigration/input-9.2.xml',
),
),
);
}

#[TestDox('Can migrate PHPUnit 9.5 configuration')]
public function testCanMigratePhpUnit95Configuration(): void
{
$this->assertEquals(
(new XmlLoader)->loadFile(__DIR__ . '/../../../../_files/XmlConfigurationMigration/output-9.5.xml'),
(new XmlLoader)->load(
(new Migrator)->migrate(
__DIR__ . '/../../../../_files/XmlConfigurationMigration/input-9.5.xml',
),
),
);
}

#[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',
),
),
);
return [
'PHPUnit 9.2' => [
__DIR__ . '/../../../../_files/XmlConfigurationMigration/output-9.2.xml',
__DIR__ . '/../../../../_files/XmlConfigurationMigration/input-9.2.xml',
],
'PHPUnit 9.5' => [
__DIR__ . '/../../../../_files/XmlConfigurationMigration/output-9.5.xml',
__DIR__ . '/../../../../_files/XmlConfigurationMigration/input-9.5.xml',
],
'Relative Path' => [
__DIR__ . '/../../../../_files/XmlConfigurationMigration/output-relative-schema-path.xml',
__DIR__ . '/../../../../_files/XmlConfigurationMigration/input-relative-schema-path.xml',
],
'Issue 5859' => [
__DIR__ . '/../../../../_files/XmlConfigurationMigration/output-issue-5859.xml',
__DIR__ . '/../../../../_files/XmlConfigurationMigration/input-issue-5859.xml',
],
'Issue 6087' => [
__DIR__ . '/../../../../_files/XmlConfigurationMigration/output-issue-6087.xml',
__DIR__ . '/../../../../_files/XmlConfigurationMigration/input-issue-6087.xml',
],
];
}

#[TestDox('Keep relative schema path when present')]
public function testKeepRelativeSchema(): void
#[DataProvider('provider')]
public function testCanMigrateConfigurationFileThatValidatesAgainstPreviousSchema(string $output, string $input): void
{
$this->assertEquals(
(new XmlLoader)->loadFile(__DIR__ . '/../../../../_files/XmlConfigurationMigration/output-relative-schema-path.xml'),
(new XmlLoader)->load(
(new Migrator)->migrate(
__DIR__ . '/../../../../_files/XmlConfigurationMigration/input-relative-schema-path.xml',
),
),
(new XmlLoader)->loadFile($output),
(new XmlLoader)->load((new Migrator)->migrate($input)),
);
}
}

0 comments on commit 15f34af

Please sign in to comment.