You are here

protected function MigrateDrupalTestBase::installMigrations in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/migrate_drupal/src/Tests/MigrateDrupalTestBase.php \Drupal\migrate_drupal\Tests\MigrateDrupalTestBase::installMigrations()

Turn all the migration templates for the specified drupal version into real migration entities so we can test them.

Parameters

string $version: Drupal version as provided in migration_tags - e.g., 'Drupal 6'.

2 calls to MigrateDrupalTestBase::installMigrations()
MigrateDrupal6TestBase::setUp in core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6TestBase.php
Performs setup tasks before each individual test method is run.
MigrateDrupal7TestBase::setUp in core/modules/migrate_drupal/src/Tests/d7/MigrateDrupal7TestBase.php
Performs setup tasks before each individual test method is run.

File

core/modules/migrate_drupal/src/Tests/MigrateDrupalTestBase.php, line 60
Contains \Drupal\migrate_drupal\Tests\MigrateDrupalTestBase.

Class

MigrateDrupalTestBase
Base class for Drupal migration tests.

Namespace

Drupal\migrate_drupal\Tests

Code

protected function installMigrations($version) {
  $migration_templates = \Drupal::service('migrate.template_storage')
    ->findTemplatesByTag($version);
  $migrations = \Drupal::service('migrate.migration_builder')
    ->createMigrations($migration_templates);
  foreach ($migrations as $migration) {
    try {
      $migration
        ->save();
    } catch (PluginNotFoundException $e) {

      // Migrations requiring modules not enabled will throw an exception.
      // Ignoring this exception is equivalent to placing config in the
      // optional subdirectory - the migrations we require for the test will
      // be successfully saved.
    }
  }
}