MigrateFileTest.php
Same filename in this branch
Same filename in other branches
- 9 core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php
- 9 core/modules/file/tests/src/Kernel/Migrate/d7/MigrateFileTest.php
- 8.9.x core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php
- 8.9.x core/modules/file/tests/src/Kernel/Migrate/d7/MigrateFileTest.php
- 11.x core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php
- 11.x core/modules/file/tests/src/Kernel/Migrate/d7/MigrateFileTest.php
Namespace
Drupal\Tests\file\Kernel\Migrate\d7File
-
core/
modules/ file/ tests/ src/ Kernel/ Migrate/ d7/ MigrateFileTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\file\Kernel\Migrate\d7;
use Drupal\file\Entity\File;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
/**
* Migrates all files in the file_managed table.
*
* @group file
*/
class MigrateFileTest extends MigrateDrupal7TestBase {
use FileMigrationSetupTrait;
/**
* {@inheritdoc}
*/
protected static $modules = [
'file',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->fileMigrationSetup();
}
/**
* {@inheritdoc}
*/
protected function getFileMigrationInfo() {
return [
'path' => 'public://sites/default/files/cube.jpeg',
'size' => 3620,
'base_path' => 'public://',
'plugin_id' => 'd7_file',
];
}
/**
* Tests that all expected files are migrated.
*/
public function testFileMigration() : void {
$this->assertEntity(1, 'cube.jpeg', 'public://cube.jpeg', 'image/jpeg', 3620, 1421727515, 1421727515, '1');
// Ensure temporary file was not migrated.
$this->assertNull(File::load(4));
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
MigrateFileTest | Migrates all files in the file_managed table. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.