You are here

protected function MediaMigrationAssertionsForMediaSourceTrait::assertMedia8FieldValues in Media Migration 8

Assertions of media 8 ("video.webm").

6 calls to MediaMigrationAssertionsForMediaSourceTrait::assertMedia8FieldValues()
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.

... See full list

File

tests/src/Traits/MediaMigrationAssertionsForMediaSourceTrait.php, line 241

Class

MediaMigrationAssertionsForMediaSourceTrait
Trait for media migration tests.

Namespace

Drupal\Tests\media_migration\Traits

Code

protected function assertMedia8FieldValues() {
  $media = $this->container
    ->get('entity_type.manager')
    ->getStorage('media')
    ->load(8);
  assert($media instanceof MediaInterface);
  $this
    ->assertEquals([
    'mid' => [
      [
        'value' => '8',
      ],
    ],
    'bundle' => [
      [
        'target_id' => 'video',
      ],
    ],
    'name' => [
      [
        'value' => 'video.webm',
      ],
    ],
    'uid' => [
      [
        'target_id' => '2',
      ],
    ],
    'status' => [
      [
        'value' => '1',
      ],
    ],
    'created' => [
      [
        'value' => '1594037784',
      ],
    ],
    'field_media_video_file' => [
      [
        'target_id' => '8',
        'display' => NULL,
        'description' => NULL,
      ],
    ],
  ], $this
    ->getImportantEntityProperties($media));

  // Check the media field.
  $media_field = $this
    ->getReferencedEntities($media, 'field_media_video_file', 1);
  assert($media_field[0] instanceof FileInterface);

  // The referenced file should exist.
  $this
    ->assertTrue(file_exists($media_field[0]
    ->getFileUri()));
}