trait FileMigrationTestTrait
Same name in other branches
- 9 core/modules/file/tests/src/Kernel/Migrate/d6/FileMigrationTestTrait.php \Drupal\Tests\file\Kernel\Migrate\d6\FileMigrationTestTrait
- 8.9.x core/modules/file/tests/src/Kernel/Migrate/d6/FileMigrationTestTrait.php \Drupal\Tests\file\Kernel\Migrate\d6\FileMigrationTestTrait
- 10 core/modules/file/tests/src/Kernel/Migrate/d6/FileMigrationTestTrait.php \Drupal\Tests\file\Kernel\Migrate\d6\FileMigrationTestTrait
Helper for setting up a file migration test.
Hierarchy
- trait \Drupal\Tests\file\Kernel\Migrate\d6\FileMigrationTestTrait
5 files declare their use of FileMigrationTestTrait
- MigrateImageTest.php in core/
modules/ image/ tests/ src/ Kernel/ Migrate/ d6/ MigrateImageTest.php - MigrateNodeCompleteTest.php in core/
modules/ node/ tests/ src/ Kernel/ Migrate/ d6/ MigrateNodeCompleteTest.php - MigrateNodeTest.php in core/
modules/ node/ tests/ src/ Kernel/ Migrate/ d6/ MigrateNodeTest.php - MigrateUserPictureD6FileTest.php in core/
modules/ user/ tests/ src/ Kernel/ Migrate/ d6/ MigrateUserPictureD6FileTest.php - MigrateUserTest.php in core/
modules/ user/ tests/ src/ Kernel/ Migrate/ d6/ MigrateUserTest.php
File
-
core/
modules/ file/ tests/ src/ Kernel/ Migrate/ d6/ FileMigrationTestTrait.php, line 12
Namespace
Drupal\Tests\file\Kernel\Migrate\d6View source
trait FileMigrationTestTrait {
/**
* Setup and execute d6_file migration.
*/
protected function setUpMigratedFiles() {
$this->installEntitySchema('file');
$this->installConfig([
'file',
]);
$this->executeMigration('d6_file');
}
/**
* {@inheritdoc}
*/
protected function prepareMigration(MigrationInterface $migration) {
// File migrations need a source_base_path.
// @see MigrateUpgradeRunBatch::run
$destination = $migration->getDestinationConfiguration();
if ($destination['plugin'] === 'entity:file') {
// Make sure we have a single trailing slash.
$source = $migration->getSourceConfiguration();
$source['site_path'] = 'core/tests/fixtures';
$source['constants']['source_base_path'] = $this->root . '/';
$migration->set('source', $source);
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
FileMigrationTestTrait::prepareMigration | protected | function | |
FileMigrationTestTrait::setUpMigratedFiles | protected | function | Setup and execute d6_file migration. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.