Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Migrator.php

function Migrator::migrate

Throws

Exception

MigrationException

XmlException

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\XmlConfiguration

Code

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();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal