class Migrator
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
@internal This class is not covered by the backward compatibility promise for PHPUnit
Hierarchy
- class \PHPUnit\TextUI\XmlConfiguration\Migrator
Expanded class hierarchy of Migrator
1 file declares its use of Migrator
- MigrateConfigurationCommand.php in vendor/
phpunit/ phpunit/ src/ TextUI/ Command/ Commands/ MigrateConfigurationCommand.php
File
-
vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Migration/ Migrator.php, line 21
Namespace
PHPUnit\TextUI\XmlConfigurationView source
final class Migrator {
/**
* @throws Exception
* @throws MigrationException
* @throws XmlException
*/
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();
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
Migrator::migrate | public | function |