MigrateFileTest.php in Drupal 10
File
core/modules/file/tests/src/Kernel/Migrate/d7/MigrateFileTest.php
View source
<?php
namespace Drupal\Tests\file\Kernel\Migrate\d7;
use Drupal\file\Entity\File;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
class MigrateFileTest extends MigrateDrupal7TestBase {
use FileMigrationSetupTrait;
protected static $modules = [
'file',
];
protected function setUp() : void {
parent::setUp();
$this
->fileMigrationSetup();
}
protected function getFileMigrationInfo() {
return [
'path' => 'public://sites/default/files/cube.jpeg',
'size' => '3620',
'base_path' => 'public://',
'plugin_id' => 'd7_file',
];
}
public function testFileMigration() {
$this
->assertEntity(1, 'cube.jpeg', 'public://cube.jpeg', 'image/jpeg', '3620', '1421727515', '1421727515', '1');
$this
->assertNull(File::load(4));
}
}