MigrateUploadEntityFormDisplayTest.php in Drupal 10
File
core/modules/file/tests/src/Kernel/Migrate/d6/MigrateUploadEntityFormDisplayTest.php
View source
<?php
namespace Drupal\Tests\file\Kernel\Migrate\d6;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
class MigrateUploadEntityFormDisplayTest extends MigrateDrupal6TestBase {
protected static $modules = [
'menu_ui',
];
protected function setUp() : void {
parent::setUp();
$this
->migrateFields();
}
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']);
$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',
]));
}
public function testSkipNonExistentNodeType() {
$this
->mockFailure('d6_node_type', [
'type' => 'story',
]);
$migration = $this
->getMigration('d6_upload_entity_form_display');
$this
->executeMigration($migration);
$this
->assertNull($migration
->getIdMap()
->lookupDestinationIds([
'node_type' => 'story',
])[0][0]);
}
}