summaryrefslogtreecommitdiff
path: root/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration')
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/MigrationBuilder.php73
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/MigrationBuilderException.php19
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/MigrationException.php19
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/ConvertLogTypes.php53
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageCloverToReport.php31
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageCrap4jToReport.php33
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageHtmlToReport.php33
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoveragePhpToReport.php31
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageTextToReport.php33
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageXmlToReport.php31
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/IntroduceCoverageElement.php28
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/LogToReportMigration.php79
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/Migration.php20
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromFilterWhitelistToCoverage.php51
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromRootToCoverage.php47
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistDirectoriesToCoverage.php49
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistExcludesToCoverage.php70
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/RemoveCacheTokensAttribute.php27
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/RemoveEmptyFilter.php54
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/RemoveLogTypes.php37
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/UpdateSchemaLocationTo93.php27
-rw-r--r--vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrator.php57
22 files changed, 902 insertions, 0 deletions
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/MigrationBuilder.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/MigrationBuilder.php
new file mode 100644
index 000000000..abef49f10
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/MigrationBuilder.php
@@ -0,0 +1,73 @@
+<?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 function array_key_exists;
+use function sprintf;
+use function version_compare;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MigrationBuilder
+{
+ private const AVAILABLE_MIGRATIONS = [
+ '8.5' => [
+ RemoveLogTypes::class,
+ ],
+
+ '9.2' => [
+ RemoveCacheTokensAttribute::class,
+ IntroduceCoverageElement::class,
+ MoveAttributesFromRootToCoverage::class,
+ MoveAttributesFromFilterWhitelistToCoverage::class,
+ MoveWhitelistDirectoriesToCoverage::class,
+ MoveWhitelistExcludesToCoverage::class,
+ RemoveEmptyFilter::class,
+ CoverageCloverToReport::class,
+ CoverageCrap4jToReport::class,
+ CoverageHtmlToReport::class,
+ CoveragePhpToReport::class,
+ CoverageTextToReport::class,
+ CoverageXmlToReport::class,
+ ConvertLogTypes::class,
+ UpdateSchemaLocationTo93::class,
+ ],
+ ];
+
+ /**
+ * @throws MigrationBuilderException
+ */
+ public function build(string $fromVersion): array
+ {
+ if (!array_key_exists($fromVersion, self::AVAILABLE_MIGRATIONS)) {
+ throw new MigrationBuilderException(
+ sprintf(
+ 'Migration from schema version %s is not supported',
+ $fromVersion
+ )
+ );
+ }
+
+ $stack = [];
+
+ foreach (self::AVAILABLE_MIGRATIONS as $version => $migrations) {
+ if (version_compare($version, $fromVersion, '<')) {
+ continue;
+ }
+
+ foreach ($migrations as $migration) {
+ $stack[] = new $migration;
+ }
+ }
+
+ return $stack;
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/MigrationBuilderException.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/MigrationBuilderException.php
new file mode 100644
index 000000000..3d3c767af
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/MigrationBuilderException.php
@@ -0,0 +1,19 @@
+<?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 RuntimeException;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MigrationBuilderException extends RuntimeException implements \PHPUnit\Exception
+{
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/MigrationException.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/MigrationException.php
new file mode 100644
index 000000000..f92b2db30
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/MigrationException.php
@@ -0,0 +1,19 @@
+<?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 RuntimeException;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MigrationException extends RuntimeException implements \PHPUnit\Exception
+{
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/ConvertLogTypes.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/ConvertLogTypes.php
new file mode 100644
index 000000000..697bbe082
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/ConvertLogTypes.php
@@ -0,0 +1,53 @@
+<?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;
+use DOMElement;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class ConvertLogTypes implements Migration
+{
+ public function migrate(DOMDocument $document): void
+ {
+ $logging = $document->getElementsByTagName('logging')->item(0);
+
+ if (!$logging instanceof DOMElement) {
+ return;
+ }
+ $types = [
+ 'junit' => 'junit',
+ 'teamcity' => 'teamcity',
+ 'testdox-html' => 'testdoxHtml',
+ 'testdox-text' => 'testdoxText',
+ 'testdox-xml' => 'testdoxXml',
+ 'plain' => 'text',
+ ];
+
+ $logNodes = [];
+
+ foreach ($logging->getElementsByTagName('log') as $logNode) {
+ if (!isset($types[$logNode->getAttribute('type')])) {
+ continue;
+ }
+
+ $logNodes[] = $logNode;
+ }
+
+ foreach ($logNodes as $oldNode) {
+ $newLogNode = $document->createElement($types[$oldNode->getAttribute('type')]);
+ $newLogNode->setAttribute('outputFile', $oldNode->getAttribute('target'));
+
+ $logging->replaceChild($newLogNode, $oldNode);
+ }
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageCloverToReport.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageCloverToReport.php
new file mode 100644
index 000000000..5f1522b9c
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageCloverToReport.php
@@ -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 DOMElement;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class CoverageCloverToReport extends LogToReportMigration
+{
+ protected function forType(): string
+ {
+ return 'coverage-clover';
+ }
+
+ protected function toReportFormat(DOMElement $logNode): DOMElement
+ {
+ $clover = $logNode->ownerDocument->createElement('clover');
+ $clover->setAttribute('outputFile', $logNode->getAttribute('target'));
+
+ return $clover;
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageCrap4jToReport.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageCrap4jToReport.php
new file mode 100644
index 000000000..afbaaec18
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageCrap4jToReport.php
@@ -0,0 +1,33 @@
+<?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 DOMElement;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class CoverageCrap4jToReport extends LogToReportMigration
+{
+ protected function forType(): string
+ {
+ return 'coverage-crap4j';
+ }
+
+ protected function toReportFormat(DOMElement $logNode): DOMElement
+ {
+ $crap4j = $logNode->ownerDocument->createElement('crap4j');
+ $crap4j->setAttribute('outputFile', $logNode->getAttribute('target'));
+
+ $this->migrateAttributes($logNode, $crap4j, ['threshold']);
+
+ return $crap4j;
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageHtmlToReport.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageHtmlToReport.php
new file mode 100644
index 000000000..7e12095b4
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageHtmlToReport.php
@@ -0,0 +1,33 @@
+<?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 DOMElement;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class CoverageHtmlToReport extends LogToReportMigration
+{
+ protected function forType(): string
+ {
+ return 'coverage-html';
+ }
+
+ protected function toReportFormat(DOMElement $logNode): DOMElement
+ {
+ $html = $logNode->ownerDocument->createElement('html');
+ $html->setAttribute('outputDirectory', $logNode->getAttribute('target'));
+
+ $this->migrateAttributes($logNode, $html, ['lowUpperBound', 'highLowerBound']);
+
+ return $html;
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoveragePhpToReport.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoveragePhpToReport.php
new file mode 100644
index 000000000..bfa10030b
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoveragePhpToReport.php
@@ -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 DOMElement;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class CoveragePhpToReport extends LogToReportMigration
+{
+ protected function forType(): string
+ {
+ return 'coverage-php';
+ }
+
+ protected function toReportFormat(DOMElement $logNode): DOMElement
+ {
+ $php = $logNode->ownerDocument->createElement('php');
+ $php->setAttribute('outputFile', $logNode->getAttribute('target'));
+
+ return $php;
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageTextToReport.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageTextToReport.php
new file mode 100644
index 000000000..063d8df0c
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageTextToReport.php
@@ -0,0 +1,33 @@
+<?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 DOMElement;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class CoverageTextToReport extends LogToReportMigration
+{
+ protected function forType(): string
+ {
+ return 'coverage-text';
+ }
+
+ protected function toReportFormat(DOMElement $logNode): DOMElement
+ {
+ $text = $logNode->ownerDocument->createElement('text');
+ $text->setAttribute('outputFile', $logNode->getAttribute('target'));
+
+ $this->migrateAttributes($logNode, $text, ['showUncoveredFiles', 'showOnlySummary']);
+
+ return $text;
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageXmlToReport.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageXmlToReport.php
new file mode 100644
index 000000000..480d7777e
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/CoverageXmlToReport.php
@@ -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 DOMElement;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class CoverageXmlToReport extends LogToReportMigration
+{
+ protected function forType(): string
+ {
+ return 'coverage-xml';
+ }
+
+ protected function toReportFormat(DOMElement $logNode): DOMElement
+ {
+ $xml = $logNode->ownerDocument->createElement('xml');
+ $xml->setAttribute('outputDirectory', $logNode->getAttribute('target'));
+
+ return $xml;
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/IntroduceCoverageElement.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/IntroduceCoverageElement.php
new file mode 100644
index 000000000..867a84417
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/IntroduceCoverageElement.php
@@ -0,0 +1,28 @@
+<?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 IntroduceCoverageElement implements Migration
+{
+ public function migrate(DOMDocument $document): void
+ {
+ $coverage = $document->createElement('coverage');
+
+ $document->documentElement->insertBefore(
+ $coverage,
+ $document->documentElement->firstChild
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/LogToReportMigration.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/LogToReportMigration.php
new file mode 100644
index 000000000..e987308b7
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/LogToReportMigration.php
@@ -0,0 +1,79 @@
+<?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 function sprintf;
+use DOMDocument;
+use DOMElement;
+use DOMXPath;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+abstract class LogToReportMigration implements Migration
+{
+ /**
+ * @throws MigrationException
+ */
+ public function migrate(DOMDocument $document): void
+ {
+ $coverage = $document->getElementsByTagName('coverage')->item(0);
+
+ if (!$coverage instanceof DOMElement) {
+ throw new MigrationException('Unexpected state - No coverage element');
+ }
+
+ $logNode = $this->findLogNode($document);
+
+ if ($logNode === null) {
+ return;
+ }
+
+ $reportChild = $this->toReportFormat($logNode);
+
+ $report = $coverage->getElementsByTagName('report')->item(0);
+
+ if ($report === null) {
+ $report = $coverage->appendChild($document->createElement('report'));
+ }
+
+ $report->appendChild($reportChild);
+ $logNode->parentNode->removeChild($logNode);
+ }
+
+ protected function migrateAttributes(DOMElement $src, DOMElement $dest, array $attributes): void
+ {
+ foreach ($attributes as $attr) {
+ if (!$src->hasAttribute($attr)) {
+ continue;
+ }
+
+ $dest->setAttribute($attr, $src->getAttribute($attr));
+ $src->removeAttribute($attr);
+ }
+ }
+
+ abstract protected function forType(): string;
+
+ abstract protected function toReportFormat(DOMElement $logNode): DOMElement;
+
+ private function findLogNode(DOMDocument $document): ?DOMElement
+ {
+ $logNode = (new DOMXPath($document))->query(
+ sprintf('//logging/log[@type="%s"]', $this->forType())
+ )->item(0);
+
+ if (!$logNode instanceof DOMElement) {
+ return null;
+ }
+
+ return $logNode;
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/Migration.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/Migration.php
new file mode 100644
index 000000000..fa4092a9f
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/Migration.php
@@ -0,0 +1,20 @@
+<?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
+ */
+interface Migration
+{
+ public function migrate(DOMDocument $document): void;
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromFilterWhitelistToCoverage.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromFilterWhitelistToCoverage.php
new file mode 100644
index 000000000..a7aab5e51
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromFilterWhitelistToCoverage.php
@@ -0,0 +1,51 @@
+<?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;
+use DOMElement;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MoveAttributesFromFilterWhitelistToCoverage implements Migration
+{
+ /**
+ * @throws MigrationException
+ */
+ public function migrate(DOMDocument $document): void
+ {
+ $whitelist = $document->getElementsByTagName('whitelist')->item(0);
+
+ if (!$whitelist) {
+ return;
+ }
+
+ $coverage = $document->getElementsByTagName('coverage')->item(0);
+
+ if (!$coverage instanceof DOMElement) {
+ throw new MigrationException('Unexpected state - No coverage element');
+ }
+
+ $map = [
+ 'addUncoveredFilesFromWhitelist' => 'includeUncoveredFiles',
+ 'processUncoveredFilesFromWhitelist' => 'processUncoveredFiles',
+ ];
+
+ foreach ($map as $old => $new) {
+ if (!$whitelist->hasAttribute($old)) {
+ continue;
+ }
+
+ $coverage->setAttribute($new, $whitelist->getAttribute($old));
+ $whitelist->removeAttribute($old);
+ }
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromRootToCoverage.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromRootToCoverage.php
new file mode 100644
index 000000000..b86b259c3
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromRootToCoverage.php
@@ -0,0 +1,47 @@
+<?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;
+use DOMElement;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MoveAttributesFromRootToCoverage implements Migration
+{
+ /**
+ * @throws MigrationException
+ */
+ public function migrate(DOMDocument $document): void
+ {
+ $map = [
+ 'disableCodeCoverageIgnore' => 'disableCodeCoverageIgnore',
+ 'ignoreDeprecatedCodeUnitsFromCodeCoverage' => 'ignoreDeprecatedCodeUnits',
+ ];
+
+ $root = $document->documentElement;
+
+ $coverage = $document->getElementsByTagName('coverage')->item(0);
+
+ if (!$coverage instanceof DOMElement) {
+ throw new MigrationException('Unexpected state - No coverage element');
+ }
+
+ foreach ($map as $old => $new) {
+ if (!$root->hasAttribute($old)) {
+ continue;
+ }
+
+ $coverage->setAttribute($new, $root->getAttribute($old));
+ $root->removeAttribute($old);
+ }
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistDirectoriesToCoverage.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistDirectoriesToCoverage.php
new file mode 100644
index 000000000..14e6cec83
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistDirectoriesToCoverage.php
@@ -0,0 +1,49 @@
+<?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;
+use DOMElement;
+use PHPUnit\Util\Xml\SnapshotNodeList;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MoveWhitelistDirectoriesToCoverage implements Migration
+{
+ /**
+ * @throws MigrationException
+ */
+ public function migrate(DOMDocument $document): void
+ {
+ $whitelist = $document->getElementsByTagName('whitelist')->item(0);
+
+ if ($whitelist === null) {
+ return;
+ }
+
+ $coverage = $document->getElementsByTagName('coverage')->item(0);
+
+ if (!$coverage instanceof DOMElement) {
+ throw new MigrationException('Unexpected state - No coverage element');
+ }
+
+ $include = $document->createElement('include');
+ $coverage->appendChild($include);
+
+ foreach (SnapshotNodeList::fromNodeList($whitelist->childNodes) as $child) {
+ if (!$child instanceof DOMElement || $child->nodeName !== 'directory') {
+ continue;
+ }
+
+ $include->appendChild($child);
+ }
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistExcludesToCoverage.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistExcludesToCoverage.php
new file mode 100644
index 000000000..d8958cf4e
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistExcludesToCoverage.php
@@ -0,0 +1,70 @@
+<?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;
+use DOMElement;
+use PHPUnit\Util\Xml\SnapshotNodeList;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MoveWhitelistExcludesToCoverage implements Migration
+{
+ /**
+ * @throws MigrationException
+ */
+ public function migrate(DOMDocument $document): void
+ {
+ $whitelist = $document->getElementsByTagName('whitelist')->item(0);
+
+ if ($whitelist === null) {
+ return;
+ }
+
+ $excludeNodes = SnapshotNodeList::fromNodeList($whitelist->getElementsByTagName('exclude'));
+
+ if ($excludeNodes->count() === 0) {
+ return;
+ }
+
+ $coverage = $document->getElementsByTagName('coverage')->item(0);
+
+ if (!$coverage instanceof DOMElement) {
+ throw new MigrationException('Unexpected state - No coverage element');
+ }
+
+ $targetExclude = $coverage->getElementsByTagName('exclude')->item(0);
+
+ if ($targetExclude === null) {
+ $targetExclude = $coverage->appendChild(
+ $document->createElement('exclude')
+ );
+ }
+
+ foreach ($excludeNodes as $excludeNode) {
+ assert($excludeNode instanceof DOMElement);
+
+ foreach (SnapshotNodeList::fromNodeList($excludeNode->childNodes) as $child) {
+ if (!$child instanceof DOMElement || !in_array($child->nodeName, ['directory', 'file'], true)) {
+ continue;
+ }
+
+ $targetExclude->appendChild($child);
+ }
+
+ if ($excludeNode->getElementsByTagName('*')->count() !== 0) {
+ throw new MigrationException('Dangling child elements in exclude found.');
+ }
+
+ $whitelist->removeChild($excludeNode);
+ }
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/RemoveCacheTokensAttribute.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/RemoveCacheTokensAttribute.php
new file mode 100644
index 000000000..0eec12ac1
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/RemoveCacheTokensAttribute.php
@@ -0,0 +1,27 @@
+<?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 RemoveCacheTokensAttribute implements Migration
+{
+ public function migrate(DOMDocument $document): void
+ {
+ $root = $document->documentElement;
+
+ if ($root->hasAttribute('cacheTokens')) {
+ $root->removeAttribute('cacheTokens');
+ }
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/RemoveEmptyFilter.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/RemoveEmptyFilter.php
new file mode 100644
index 000000000..8f1a6d547
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/RemoveEmptyFilter.php
@@ -0,0 +1,54 @@
+<?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 function sprintf;
+use DOMDocument;
+use DOMElement;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class RemoveEmptyFilter implements Migration
+{
+ /**
+ * @throws MigrationException
+ */
+ public function migrate(DOMDocument $document): void
+ {
+ $whitelist = $document->getElementsByTagName('whitelist')->item(0);
+
+ if ($whitelist instanceof DOMElement) {
+ $this->ensureEmpty($whitelist);
+ $whitelist->parentNode->removeChild($whitelist);
+ }
+
+ $filter = $document->getElementsByTagName('filter')->item(0);
+
+ if ($filter instanceof DOMElement) {
+ $this->ensureEmpty($filter);
+ $filter->parentNode->removeChild($filter);
+ }
+ }
+
+ /**
+ * @throws MigrationException
+ */
+ private function ensureEmpty(DOMElement $element): void
+ {
+ if ($element->attributes->length > 0) {
+ throw new MigrationException(sprintf('%s element has unexpected attributes', $element->nodeName));
+ }
+
+ if ($element->getElementsByTagName('*')->length > 0) {
+ throw new MigrationException(sprintf('%s element has unexpected children', $element->nodeName));
+ }
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/RemoveLogTypes.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/RemoveLogTypes.php
new file mode 100644
index 000000000..99a762b18
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/RemoveLogTypes.php
@@ -0,0 +1,37 @@
+<?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;
+use DOMElement;
+use PHPUnit\Util\Xml\SnapshotNodeList;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class RemoveLogTypes implements Migration
+{
+ public function migrate(DOMDocument $document): void
+ {
+ $logging = $document->getElementsByTagName('logging')->item(0);
+
+ if (!$logging instanceof DOMElement) {
+ return;
+ }
+
+ foreach (SnapshotNodeList::fromNodeList($logging->getElementsByTagName('log')) as $logNode) {
+ switch ($logNode->getAttribute('type')) {
+ case 'json':
+ case 'tap':
+ $logging->removeChild($logNode);
+ }
+ }
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/UpdateSchemaLocationTo93.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/UpdateSchemaLocationTo93.php
new file mode 100644
index 000000000..2e86ab6e9
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/UpdateSchemaLocationTo93.php
@@ -0,0 +1,27 @@
+<?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 UpdateSchemaLocationTo93 implements Migration
+{
+ public function migrate(DOMDocument $document): void
+ {
+ $document->documentElement->setAttributeNS(
+ 'http://www.w3.org/2001/XMLSchema-instance',
+ 'xsi:noNamespaceSchemaLocation',
+ 'https://schema.phpunit.de/9.3/phpunit.xsd'
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrator.php b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrator.php
new file mode 100644
index 000000000..d173e7af2
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrator.php
@@ -0,0 +1,57 @@
+<?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 function sprintf;
+use PHPUnit\Util\Xml\Exception as XmlException;
+use PHPUnit\Util\Xml\Loader as XmlLoader;
+use PHPUnit\Util\Xml\SchemaDetector;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class Migrator
+{
+ /**
+ * @throws Exception
+ * @throws MigrationBuilderException
+ * @throws MigrationException
+ * @throws XmlException
+ */
+ public function migrate(string $filename): string
+ {
+ $origin = (new SchemaDetector)->detect($filename);
+
+ if (!$origin->detected()) {
+ throw new Exception(
+ sprintf(
+ '"%s" is not a valid PHPUnit XML configuration file that can be migrated',
+ $filename,
+ )
+ );
+ }
+
+ $configurationDocument = (new XmlLoader)->loadFile(
+ $filename,
+ false,
+ true,
+ true
+ );
+
+ foreach ((new MigrationBuilder)->build($origin->version()) as $migration) {
+ $migration->migrate($configurationDocument);
+ }
+
+ $configurationDocument->formatOutput = true;
+ $configurationDocument->preserveWhiteSpace = false;
+
+ return $configurationDocument->saveXML();
+ }
+}