You are here

protected function MediaMigrationPlainTestBase::executeMediaMigrations in Media Migration 8

Executes migrations of the media source database.

Parameters

bool $classic_node_migration: Whether the classic node migration has to be executed or not.

Overrides MediaMigrationTestBase::executeMediaMigrations

4 calls to MediaMigrationPlainTestBase::executeMediaMigrations()
MediaMigrationPlainFormatterWidgetTest::testWidgetsAndFormattersWithMediaLibrary in tests/src/Kernel/Migrate/MediaMigrationPlainFormatterWidgetTest.php
Tests media widgets' and formatters' migration with Media Library.
MediaMigrationPlainFormatterWidgetTest::testWidgetsAndFormattersWithoutMediaLibrary in tests/src/Kernel/Migrate/MediaMigrationPlainFormatterWidgetTest.php
Tests media widgets' and formatters' migration without Media Library.
MediaMigrationPlainTest::testChangeTracking in tests/src/Kernel/Migrate/MediaMigrationPlainTest.php
Tests media entity migration with change tracking enabled.
MediaMigrationPlainTest::testPlainFileToMediaMigration in tests/src/Kernel/Migrate/MediaMigrationPlainTest.php
Tests the migration of plain file and image fields to media reference.

File

tests/src/Kernel/Migrate/MediaMigrationPlainTestBase.php, line 51

Class

MediaMigrationPlainTestBase
Base class for Media Migration kernel tests for non-media sources.

Namespace

Drupal\Tests\media_migration\Kernel\Migrate

Code

protected function executeMediaMigrations(bool $classic_node_migration = FALSE) {

  // The Drupal 8|9 entity revision migration causes a file not found
  // exception without properly migrated files. For this test, it is enough to
  // properly migrate the public files.
  $fs_fixture_path = implode(DIRECTORY_SEPARATOR, [
    DRUPAL_ROOT,
    drupal_get_path('module', 'media_migration'),
    'tests',
    'fixtures',
  ]);
  $file_migration = $this
    ->getMigration('d7_file');
  $source = $file_migration
    ->getSourceConfiguration();
  $source['constants']['source_base_path'] = $fs_fixture_path;
  $file_migration
    ->set('source', $source);
  $this
    ->executeMigration($file_migration);
  $this
    ->executeMigrations([
    'd7_view_modes',
    'd7_field',
    'd7_node_type',
    'd7_file_plain_type',
    'd7_field_instance',
    'd7_file_plain_source_field',
    'd7_file_plain_source_field_config',
    'd7_field_formatter_settings',
    'd7_field_instance_widget_settings',
    'd7_file_plain_formatter',
    'd7_file_plain_widget',
    'd7_filter_format',
    // Nodes and media entities need an owner.
    'd7_user_role',
    'd7_user',
    'd7_file_plain',
    $classic_node_migration ? 'd7_node' : 'd7_node_complete',
  ]);
}