protected function MigrateFileTest::assertEntity in Zircon Profile 8
Same name in this branch
- 8 core/modules/file/src/Tests/Migrate/d6/MigrateFileTest.php \Drupal\file\Tests\Migrate\d6\MigrateFileTest::assertEntity()
- 8 core/modules/file/src/Tests/Migrate/d7/MigrateFileTest.php \Drupal\file\Tests\Migrate\d7\MigrateFileTest::assertEntity()
Same name and namespace in other branches
- 8.0 core/modules/file/src/Tests/Migrate/d7/MigrateFileTest.php \Drupal\file\Tests\Migrate\d7\MigrateFileTest::assertEntity()
Tests a single file entity.
Parameters
integer $id: The file ID.
string $name: The expected file name.
string $uri: The expected URI.
string $mime: The expected MIME type.
integer $size: The expected file size.
integer $created: The expected creation time.
integer $changed: The expected modification time.
integer $uid: The expected owner ID.
1 call to MigrateFileTest::assertEntity()
- MigrateFileTest::testFileMigration in core/
modules/ file/ src/ Tests/ Migrate/ d7/ MigrateFileTest.php - Tests that all expected files are migrated.
File
- core/
modules/ file/ src/ Tests/ Migrate/ d7/ MigrateFileTest.php, line 73 - Contains \Drupal\file\Tests\Migrate\d7\MigrateFileTest.
Class
- MigrateFileTest
- Migrates all files in the file_managed table.
Namespace
Drupal\file\Tests\Migrate\d7Code
protected function assertEntity($id, $name, $uri, $mime, $size, $created, $changed, $uid) {
/** @var \Drupal\file\FileInterface $file */
$file = File::load($id);
$this
->assertTrue($file instanceof FileInterface);
$this
->assertIdentical($name, $file
->getFilename());
$this
->assertIdentical($uri, $file
->getFileUri());
$this
->assertTrue(file_exists($uri));
$this
->assertIdentical($mime, $file
->getMimeType());
$this
->assertIdentical($size, $file
->getSize());
// isPermanent(), isTemporary(), etc. are determined by the status column.
$this
->assertTrue($file
->isPermanent());
$this
->assertIdentical($created, $file
->getCreatedTime());
$this
->assertIdentical($changed, $file
->getChangedTime());
$this
->assertIdentical($uid, $file
->getOwnerId());
}