Skip to content

Commit

Permalink
Migration for #4531
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 28, 2020
1 parent dbba41d commit 297a7d3
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/TextUI/XmlConfiguration/Migration/MigrationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ final class MigrationBuilder

'9.5' => [
RemoveListeners::class,
RemoveTestSuiteLoaderAttributes::class,
],
];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\TextUI\XmlConfiguration;

use DOMDocument;

/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class RemoveTestSuiteLoaderAttributes implements Migration
{
public function migrate(DOMDocument $document): void
{
$root = $document->documentElement;

if ($root->hasAttribute('testSuiteLoaderClass')) {
$root->removeAttribute('testSuiteLoaderClass');
}

if ($root->hasAttribute('testSuiteLoaderFile')) {
$root->removeAttribute('testSuiteLoaderFile');
}
}
}
4 changes: 3 additions & 1 deletion tests/_files/XmlConfigurationMigration/input-9.5.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd">
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
testSuiteLoaderClass="Foo"
testSuiteLoaderFile="Foo.php">

<listeners>
<listener class="MyListener" file="/optional/path/to/MyListener.php">
Expand Down

0 comments on commit 297a7d3

Please sign in to comment.