MigrateUploadInstanceTest.php in Drupal 10
File
core/modules/file/tests/src/Kernel/Migrate/d6/MigrateUploadInstanceTest.php
View source
<?php
namespace Drupal\Tests\file\Kernel\Migrate\d6;
use Drupal\field\Entity\FieldConfig;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
class MigrateUploadInstanceTest extends MigrateDrupal6TestBase {
protected static $modules = [
'menu_ui',
];
protected function setUp() : void {
parent::setUp();
$this
->migrateFields();
}
public function testUploadFieldInstance() {
$field = FieldConfig::load('node.page.upload');
$settings = $field
->getSettings();
$this
->assertSame('node.page.upload', $field
->id());
$this
->assertSame('jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp', $settings['file_extensions']);
$this
->assertSame('1MB', $settings['max_filesize']);
$this
->assertTrue($settings['description_field']);
$field = FieldConfig::load('node.story.upload');
$this
->assertSame('node.story.upload', $field
->id());
$field = FieldConfig::load('node.article.upload');
$this
->assertNull($field);
$this
->assertSame([
[
'node',
'page',
'upload',
],
], $this
->getMigration('d6_upload_field_instance')
->getIdMap()
->lookupDestinationIds([
'page',
]));
}
}