protected function MediaMigrationAssertionsForMediaSourceTrait::assertMedia6FieldValues in Media Migration 8
Assertions of media 6 (LICENSE.txt).
6 calls to MediaMigrationAssertionsForMediaSourceTrait::assertMedia6FieldValues()
- DrushWithCoreMigrationsFromMediaTest::testAllMigrationWithDrush in tests/
src/ Functional/ DrushWithCoreMigrationsFromMediaTest.php - Test all migrations with Drush and Migrate Tools.
- DrushWithCoreMigrationsFromMediaTest::testMigrationWithDrush in tests/
src/ Functional/ DrushWithCoreMigrationsFromMediaTest.php - Test media migrations with Drush and Migrate Tools.
- DrushWithMigrateUpgradeFromMediaTest::testMigrationWithDrush in tests/
src/ Functional/ DrushWithMigrateUpgradeFromMediaTest.php - Tests migrations with Migrate Upgrade, Drush and Migrate Tools.
- MediaMigrationTest::testMediaMigration in tests/
src/ Kernel/ Migrate/ MediaMigrationTest.php - Tests the migration of media entities.
- MediaMigrationWithoutImageTitleTest::testMediaWithoutImageTitleMigration in tests/
src/ Kernel/ Migrate/ MediaMigrationWithoutImageTitleTest.php - Tests the migration of media entities without image title.
File
- tests/
src/ Traits/ MediaMigrationAssertionsForMediaSourceTrait.php, line 179
Class
- MediaMigrationAssertionsForMediaSourceTrait
- Trait for media migration tests.
Namespace
Drupal\Tests\media_migration\TraitsCode
protected function assertMedia6FieldValues() {
$media6 = $this->container
->get('entity_type.manager')
->getStorage('media')
->load(6);
assert($media6 instanceof MediaInterface);
$this
->assertEquals('LICENSE.txt', $media6
->label());
$this
->assertEquals('document', $media6
->bundle());
// Check 'field media file' field.
$media6_file = $this
->getReferencedEntities($media6, 'field_media_document', 1);
assert($media6_file[0] instanceof FileInterface);
$this
->assertEquals('6', $media6_file[0]
->id());
$this
->assertEquals('6', $media6->field_media_document->target_id);
// Author should be user 1.
$this
->assertEquals('1', $media6
->getOwnerId());
// Assert authored on date.
$this
->assertEquals('1587731111', $media6
->getCreatedTime());
// The file should exist.
$this
->assertTrue(file_exists($media6_file[0]
->getFileUri()));
}