View source
<?php
namespace Drupal\Tests\media_migration\Kernel\Migrate;
use Drupal\Tests\media_migration\Traits\MediaMigrationAssertionsForNonMediaSourceTrait;
abstract class MediaMigrationPlainTestBase extends MediaMigrationTestBase {
use MediaMigrationAssertionsForNonMediaSourceTrait;
public static $modules = [
'editor',
'field',
'file',
'filter',
'image',
'link',
'linkit',
'media',
'media_migration',
'menu_ui',
'migrate',
'migrate_drupal',
'migrate_plus',
'node',
'options',
'smart_sql_idmap',
'system',
'taxonomy',
'telephone',
'text',
'user',
];
protected function getFixtureFilePath() {
return drupal_get_path('module', 'media_migration') . '/tests/fixtures/drupal7_nomedia.php';
}
protected function executeMediaMigrations(bool $classic_node_migration = FALSE) {
$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',
'd7_user_role',
'd7_user',
'd7_file_plain',
$classic_node_migration ? 'd7_node' : 'd7_node_complete',
]);
}
}