class MigrateDrupal6TestBase

Same name in this branch
  1. 9 core/modules/aggregator/tests/src/Kernel/Migrate/d6/MigrateDrupal6TestBase.php \Drupal\Tests\aggregator\Kernel\Migrate\d6\MigrateDrupal6TestBase
Same name and namespace in other branches
  1. 10 core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6TestBase.php \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase
  2. 11.x core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6TestBase.php \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase
  3. 8.9.x core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6TestBase.php \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase

Base class for Drupal 6 migration tests.

Hierarchy

Expanded class hierarchy of MigrateDrupal6TestBase

98 files declare their use of MigrateDrupal6TestBase
IdMapTableNoDummyTest.php in core/modules/migrate_drupal/tests/src/Kernel/IdMapTableNoDummyTest.php
MigrateActionConfigsTest.php in core/modules/system/tests/src/Kernel/Migrate/d6/MigrateActionConfigsTest.php
MigrateActionsTest.php in core/modules/system/tests/src/Kernel/Migrate/d6/MigrateActionsTest.php
MigrateBlockContentTest.php in core/modules/block_content/tests/src/Kernel/Migrate/d6/MigrateBlockContentTest.php
MigrateBlockContentTranslationTest.php in core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockContentTranslationTest.php

... See full list

File

core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6TestBase.php, line 12

Namespace

Drupal\Tests\migrate_drupal\Kernel\d6
View source
abstract class MigrateDrupal6TestBase extends MigrateDrupalTestBase {
  use NodeMigrateTypeTestTrait;
  
  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'datetime',
    'filter',
    'image',
    'link',
    'node',
    'options',
    'telephone',
    'text',
  ];
  
  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
    // Add a node classic migrate table to the destination site so that tests
    // run by default with the classic node migrations.
    $this->makeNodeMigrateMapTable(NodeMigrateType::NODE_MIGRATE_TYPE_CLASSIC, '6');
    $this->loadFixture($this->getFixtureFilePath());
  }
  
  /**
   * Gets the path to the fixture file.
   */
  protected function getFixtureFilePath() {
    return __DIR__ . '/../../../fixtures/drupal6.php';
  }
  
  /**
   * Executes all user migrations.
   *
   * @param bool $include_pictures
   *   If TRUE, migrates user pictures.
   */
  protected function migrateUsers($include_pictures = TRUE) {
    $this->executeMigrations([
      'd6_filter_format',
      'd6_user_role',
    ]);
    if ($include_pictures) {
      $this->installEntitySchema('file');
      $this->executeMigrations([
        'd6_file',
        'd6_user_picture_file',
        'user_picture_field',
        'user_picture_field_instance',
        'user_picture_entity_display',
        'user_picture_entity_form_display',
      ]);
    }
    $this->executeMigration('d6_user');
  }
  
  /**
   * Migrates node types.
   */
  protected function migrateContentTypes() {
    $this->installConfig([
      'node',
    ]);
    $this->executeMigration('d6_node_type');
  }
  
  /**
   * Executes all field migrations.
   */
  protected function migrateFields() {
    $this->migrateContentTypes();
    $this->executeMigrations([
      'd6_field',
      'd6_field_instance',
      'd6_field_instance_widget_settings',
      'd6_view_modes',
      'd6_field_formatter_settings',
      'd6_upload_field',
      'd6_upload_field_instance',
    ]);
  }
  
  /**
   * Executes all content migrations.
   *
   * @param array $include
   *   Extra things to include as part of the migrations. Values may be
   *   'revisions' or 'translations'.
   */
  protected function migrateContent(array $include = []) {
    if (in_array('translations', $include)) {
      $this->executeMigrations([
        'language',
      ]);
    }
    $this->migrateUsers(FALSE);
    $this->migrateFields();
    $this->installEntitySchema('node');
    $this->executeMigrations([
      'd6_node_settings',
      'd6_node',
    ]);
    if (in_array('translations', $include)) {
      $this->executeMigrations([
        'd6_node_translation',
      ]);
    }
    if (in_array('revisions', $include)) {
      $this->executeMigrations([
        'd6_node_revision',
      ]);
    }
  }
  
  /**
   * Executes all taxonomy migrations.
   */
  protected function migrateTaxonomy() {
    $this->migrateContentTypes();
    $this->installEntitySchema('taxonomy_term');
    $this->executeMigrations([
      'd6_taxonomy_vocabulary',
      'd6_vocabulary_field',
      'd6_vocabulary_field_instance',
      'd6_vocabulary_entity_display',
      'd6_vocabulary_entity_form_display',
      'd6_taxonomy_term',
    ]);
  }

}

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