protected function ImageTest::assertEntity in Commerce Migrate 3.1.x
Same name and namespace in other branches
- 8.2 modules/csv_example/tests/src/Kernel/Migrate/ImageTest.php \Drupal\Tests\commerce_migrate_csv_example\Kernel\Migrate\ImageTest::assertEntity()
- 3.0.x modules/csv_example/tests/src/Kernel/Migrate/ImageTest.php \Drupal\Tests\commerce_migrate_csv_example\Kernel\Migrate\ImageTest::assertEntity()
Tests a single file entity.
Parameters
int $id: The file ID.
string $name: The expected file name.
string $uri: The expected URI.
string $mime: The expected MIME type.
int $size: The expected file size.
int $uid: The expected owner ID.
1 call to ImageTest::assertEntity()
- ImageTest::testFileMigration in modules/
csv_example/ tests/ src/ Kernel/ Migrate/ ImageTest.php - Tests image file migration from CSV source file.
File
- modules/
csv_example/ tests/ src/ Kernel/ Migrate/ ImageTest.php, line 74
Class
- ImageTest
- Tests Product migration.
Namespace
Drupal\Tests\commerce_migrate_csv_example\Kernel\MigrateCode
protected function assertEntity($id, $name, $uri, $mime, $size, $uid) {
/** @var \Drupal\file\FileInterface $file */
$file = File::load($id);
$this
->assertTrue($file instanceof FileInterface);
$this
->assertSame($name, $file
->getFilename());
$this
->assertSame($uri, $file
->getFileUri());
$this
->assertTrue(file_exists($uri));
$this
->assertSame($mime, $file
->getMimeType());
$this
->assertSame($size, $file
->getSize());
$this
->assertTrue($file
->isPermanent());
$this
->assertSame($uid, $file
->getOwnerId());
}