class MigrateUploadEntityFormDisplayTest
Same name and namespace in other branches
- 10 core/modules/file/tests/src/Kernel/Migrate/d6/MigrateUploadEntityFormDisplayTest.php \Drupal\Tests\file\Kernel\Migrate\d6\MigrateUploadEntityFormDisplayTest
- 11.x core/modules/file/tests/src/Kernel/Migrate/d6/MigrateUploadEntityFormDisplayTest.php \Drupal\Tests\file\Kernel\Migrate\d6\MigrateUploadEntityFormDisplayTest
- 8.9.x core/modules/file/tests/src/Kernel/Migrate/d6/MigrateUploadEntityFormDisplayTest.php \Drupal\Tests\file\Kernel\Migrate\d6\MigrateUploadEntityFormDisplayTest
Upload form entity display.
@group migrate_drupal_6
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase implements \Drupal\migrate\MigrateMessageInterface extends \Drupal\KernelTests\KernelTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase extends \Drupal\Tests\migrate\Kernel\MigrateTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase uses \Drupal\Tests\migrate_drupal\Traits\NodeMigrateTypeTestTrait extends \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\file\Kernel\Migrate\d6\MigrateUploadEntityFormDisplayTest extends \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase
- class \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase uses \Drupal\Tests\migrate_drupal\Traits\NodeMigrateTypeTestTrait extends \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase extends \Drupal\Tests\migrate\Kernel\MigrateTestBase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase implements \Drupal\migrate\MigrateMessageInterface extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of MigrateUploadEntityFormDisplayTest
File
-
core/
modules/ file/ tests/ src/ Kernel/ Migrate/ d6/ MigrateUploadEntityFormDisplayTest.php, line 13
Namespace
Drupal\Tests\file\Kernel\Migrate\d6View source
class MigrateUploadEntityFormDisplayTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'menu_ui',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->migrateFields();
}
/**
* Tests Drupal 6 upload settings to Drupal 8 entity form display migration.
*/
public function testUploadEntityFormDisplay() {
$this->executeMigration('d6_upload_entity_form_display');
$display = EntityFormDisplay::load('node.page.default');
$component = $display->getComponent('upload');
$this->assertSame('file_generic', $component['type']);
$display = EntityFormDisplay::load('node.story.default');
$component = $display->getComponent('upload');
$this->assertSame('file_generic', $component['type']);
// Assure this doesn't exist.
$display = EntityFormDisplay::load('node.article.default');
$component = $display->getComponent('upload');
$this->assertNull($component);
$this->assertSame([
[
'node',
'page',
'default',
'upload',
],
], $this->getMigration('d6_upload_entity_form_display')
->getIdMap()
->lookupDestinationIds([
'page',
]));
}
/**
* Tests that entity displays are ignored appropriately.
*
* Entity displays should be ignored when they belong to node types which
* were not migrated.
*/
public function testSkipNonExistentNodeType() {
// The "story" node type is migrated by d6_node_type but we need to pretend
// that it didn't occur, so record that in the map table.
$this->mockFailure('d6_node_type', [
'type' => 'story',
]);
// d6_upload_entity_form_display should skip over the "story" node type
// config because according to the map table, it didn't occur.
$migration = $this->getMigration('d6_upload_entity_form_display');
$this->executeMigration($migration);
$this->assertNull($migration->getIdMap()
->lookupDestinationIds([
'node_type' => 'story',
])[0][0]);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.