You are here

protected function MigrateFileTest::assertEntity in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php \Drupal\Tests\file\Kernel\Migrate\d6\MigrateFileTest::assertEntity()
  2. 9 core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php \Drupal\Tests\file\Kernel\Migrate\d6\MigrateFileTest::assertEntity()

Asserts a file entity.

@internal

Parameters

int $fid: The file ID.

string $name: The expected file name.

int $size: The expected file size.

string $uri: The expected file URI.

string $type: The expected MIME type.

int $uid: The expected file owner ID.

1 call to MigrateFileTest::assertEntity()
MigrateFileTest::testFiles in core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php
Tests the Drupal 6 files to Drupal 8 migration.

File

core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php, line 62

Class

MigrateFileTest
Test file migration.

Namespace

Drupal\Tests\file\Kernel\Migrate\d6

Code

protected function assertEntity(int $fid, string $name, int $size, string $uri, string $type, int $uid) : void {

  /** @var \Drupal\file\FileInterface $file */
  $file = File::load($fid);
  $this
    ->assertInstanceOf(FileInterface::class, $file);
  $this
    ->assertSame($name, $file
    ->getFilename());
  $this
    ->assertSame($size, (int) $file
    ->getSize());
  $this
    ->assertSame($uri, $file
    ->getFileUri());
  $this
    ->assertSame($type, $file
    ->getMimeType());
  $this
    ->assertSame($uid, (int) $file
    ->getOwnerId());
}