trait CreateMigrationsTrait

Same name in other branches
  1. 9 core/modules/migrate_drupal/tests/src/Traits/CreateMigrationsTrait.php \Drupal\Tests\migrate_drupal\Traits\CreateMigrationsTrait
  2. 8.9.x core/modules/migrate_drupal/tests/src/Traits/CreateMigrationsTrait.php \Drupal\Tests\migrate_drupal\Traits\CreateMigrationsTrait
  3. 11.x core/modules/migrate_drupal/tests/src/Traits/CreateMigrationsTrait.php \Drupal\Tests\migrate_drupal\Traits\CreateMigrationsTrait

Hierarchy

1 file declares its use of CreateMigrationsTrait
DestinationCategoryTest.php in core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/DestinationCategoryTest.php

File

core/modules/migrate_drupal/tests/src/Traits/CreateMigrationsTrait.php, line 7

Namespace

Drupal\Tests\migrate_drupal\Traits
View source
trait CreateMigrationsTrait {
    
    /**
     * Create instances of all Drupal 6 migrations.
     *
     * @return \Drupal\migrate\Plugin\MigrationInterface[]
     *   The migrations
     */
    public function drupal6Migrations() {
        $dirs = \Drupal::service('module_handler')->getModuleDirectories();
        $migrate_drupal_directory = $dirs['migrate_drupal'];
        $this->loadFixture("{$migrate_drupal_directory}/tests/fixtures/drupal6.php");
        return \Drupal::service('plugin.manager.migration')->createInstancesByTag('Drupal 6');
    }
    
    /**
     * Create instances of all Drupal 7 migrations.
     *
     * @return \Drupal\migrate\Plugin\MigrationInterface[]
     *   The migrations
     */
    public function drupal7Migrations() {
        $dirs = \Drupal::service('module_handler')->getModuleDirectories();
        $migrate_drupal_directory = $dirs['migrate_drupal'];
        $this->loadFixture("{$migrate_drupal_directory}/tests/fixtures/drupal7.php");
        return \Drupal::service('plugin.manager.migration')->createInstancesByTag('Drupal 7');
    }

}

Members

Title Sort descending Modifiers Object type Summary
CreateMigrationsTrait::drupal6Migrations public function Create instances of all Drupal 6 migrations.
CreateMigrationsTrait::drupal7Migrations public function Create instances of all Drupal 7 migrations.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.