function Migrator::migrate
Throws
File
-
vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Migration/ Migrator.php, line 28
Class
- Migrator
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\TextUI\XmlConfigurationCode
public function migrate(string $filename) : string {
$origin = (new SchemaDetector())->detect($filename);
if (!$origin->detected()) {
throw new Exception('The file does not validate against any known schema');
}
if ($origin->version() === Version::series()) {
throw new Exception('The file does not need to be migrated');
}
$configurationDocument = (new XmlLoader())->loadFile($filename);
foreach ((new MigrationBuilder())->build($origin->version()) as $migration) {
$migration->migrate($configurationDocument);
}
$configurationDocument->formatOutput = true;
$configurationDocument->preserveWhiteSpace = false;
return $configurationDocument->saveXML();
}