function LogToReportMigration::migrate
Throws
Overrides Migration::migrate
File
-
vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Migration/ Migrations/ LogToReportMigration.php, line 27
Class
- LogToReportMigration
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\TextUI\XmlConfigurationCode
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);
}