protected function MediaMigrationAssertionsForMediaSourceTrait::assertMedia12FieldValues in Media Migration 8
Assertions of media 12 ("document.odt").
6 calls to MediaMigrationAssertionsForMediaSourceTrait::assertMedia12FieldValues()
- 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 364
Class
- MediaMigrationAssertionsForMediaSourceTrait
- Trait for media migration tests.
Namespace
Drupal\Tests\media_migration\TraitsCode
protected function assertMedia12FieldValues() {
$media = $this->container
->get('entity_type.manager')
->getStorage('media')
->load(12);
assert($media instanceof MediaInterface);
$this
->assertEquals([
'mid' => [
[
'value' => '12',
],
],
'bundle' => [
[
'target_id' => 'document',
],
],
'name' => [
[
'value' => 'document.odt',
],
],
'uid' => [
[
'target_id' => '2',
],
],
'status' => [
[
'value' => '1',
],
],
'created' => [
[
'value' => '1594201103',
],
],
'field_media_document' => [
[
'target_id' => '12',
'display' => NULL,
'description' => NULL,
],
],
], $this
->getImportantEntityProperties($media));
// Check the media field.
$media_field = $this
->getReferencedEntities($media, 'field_media_document', 1);
assert($media_field[0] instanceof FileInterface);
// The referenced file should exist.
$this
->assertTrue(file_exists($media_field[0]
->getFileUri()));
}