|
9 | 9 | */
|
10 | 10 | namespace PHPUnit\TextUI\XmlConfiguration;
|
11 | 11 |
|
12 |
| -use PHPUnit\Framework\Attributes\TestDox; |
13 |
| -use PHPUnit\Framework\Attributes\Ticket; |
| 12 | +use PHPUnit\Framework\Attributes\DataProvider; |
14 | 13 | use PHPUnit\Framework\TestCase;
|
15 | 14 | use PHPUnit\Util\Xml\Loader as XmlLoader;
|
16 | 15 |
|
17 | 16 | final class MigratorTest extends TestCase
|
18 | 17 | {
|
19 |
| - #[TestDox('Can migrate PHPUnit 9.2 configuration')] |
20 |
| - public function testCanMigratePhpUnit92Configuration(): void |
| 18 | + public static function provider(): array |
21 | 19 | {
|
22 |
| - $this->assertEquals( |
23 |
| - (new XmlLoader)->loadFile(__DIR__ . '/../../../../_files/XmlConfigurationMigration/output-9.2.xml'), |
24 |
| - (new XmlLoader)->load( |
25 |
| - (new Migrator)->migrate( |
26 |
| - __DIR__ . '/../../../../_files/XmlConfigurationMigration/input-9.2.xml', |
27 |
| - ), |
28 |
| - ), |
29 |
| - ); |
30 |
| - } |
31 |
| - |
32 |
| - #[TestDox('Can migrate PHPUnit 9.5 configuration')] |
33 |
| - public function testCanMigratePhpUnit95Configuration(): void |
34 |
| - { |
35 |
| - $this->assertEquals( |
36 |
| - (new XmlLoader)->loadFile(__DIR__ . '/../../../../_files/XmlConfigurationMigration/output-9.5.xml'), |
37 |
| - (new XmlLoader)->load( |
38 |
| - (new Migrator)->migrate( |
39 |
| - __DIR__ . '/../../../../_files/XmlConfigurationMigration/input-9.5.xml', |
40 |
| - ), |
41 |
| - ), |
42 |
| - ); |
43 |
| - } |
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 |
| - ); |
| 20 | + return [ |
| 21 | + 'PHPUnit 9.2' => [ |
| 22 | + __DIR__ . '/../../../../_files/XmlConfigurationMigration/output-9.2.xml', |
| 23 | + __DIR__ . '/../../../../_files/XmlConfigurationMigration/input-9.2.xml', |
| 24 | + ], |
| 25 | + 'PHPUnit 9.5' => [ |
| 26 | + __DIR__ . '/../../../../_files/XmlConfigurationMigration/output-9.5.xml', |
| 27 | + __DIR__ . '/../../../../_files/XmlConfigurationMigration/input-9.5.xml', |
| 28 | + ], |
| 29 | + 'Relative Path' => [ |
| 30 | + __DIR__ . '/../../../../_files/XmlConfigurationMigration/output-relative-schema-path.xml', |
| 31 | + __DIR__ . '/../../../../_files/XmlConfigurationMigration/input-relative-schema-path.xml', |
| 32 | + ], |
| 33 | + 'Issue 5859' => [ |
| 34 | + __DIR__ . '/../../../../_files/XmlConfigurationMigration/output-issue-5859.xml', |
| 35 | + __DIR__ . '/../../../../_files/XmlConfigurationMigration/input-issue-5859.xml', |
| 36 | + ], |
| 37 | + 'Issue 6087' => [ |
| 38 | + __DIR__ . '/../../../../_files/XmlConfigurationMigration/output-issue-6087.xml', |
| 39 | + __DIR__ . '/../../../../_files/XmlConfigurationMigration/input-issue-6087.xml', |
| 40 | + ], |
| 41 | + ]; |
57 | 42 | }
|
58 | 43 |
|
59 |
| - #[TestDox('Keep relative schema path when present')] |
60 |
| - public function testKeepRelativeSchema(): void |
| 44 | + #[DataProvider('provider')] |
| 45 | + public function testCanMigrateConfigurationFileThatValidatesAgainstPreviousSchema(string $output, string $input): void |
61 | 46 | {
|
62 | 47 | $this->assertEquals(
|
63 |
| - (new XmlLoader)->loadFile(__DIR__ . '/../../../../_files/XmlConfigurationMigration/output-relative-schema-path.xml'), |
64 |
| - (new XmlLoader)->load( |
65 |
| - (new Migrator)->migrate( |
66 |
| - __DIR__ . '/../../../../_files/XmlConfigurationMigration/input-relative-schema-path.xml', |
67 |
| - ), |
68 |
| - ), |
| 48 | + (new XmlLoader)->loadFile($output), |
| 49 | + (new XmlLoader)->load((new Migrator)->migrate($input)), |
69 | 50 | );
|
70 | 51 | }
|
71 | 52 | }
|
0 commit comments