protected function MediaMigrationAssertionsForNonMediaSourceTrait::assertNonMediaToMedia7FieldValues in Media Migration 8
Asserts the migration result from file ID 7 to media 7.
5 calls to MediaMigrationAssertionsForNonMediaSourceTrait::assertNonMediaToMedia7FieldValues()
- DrushWithCoreMigrationsFromFileTest::testAllMigrationWithDrush in tests/
src/ Functional/ DrushWithCoreMigrationsFromFileTest.php - Test all migrations with Drush and Migrate Tools.
- DrushWithCoreMigrationsFromFileTest::testMigrationWithDrush in tests/
src/ Functional/ DrushWithCoreMigrationsFromFileTest.php - Test migrations provided by core Migrate API with Drush and Migrate Tools.
- DrushWithMigrateUpgradeFromFileTest::testMigrationWithDrush in tests/
src/ Functional/ DrushWithMigrateUpgradeFromFileTest.php - Tests migrations with Migrate Upgrade, Drush and Migrate Tools.
- MediaMigrationPlainTest::testPlainFileToMediaMigration in tests/
src/ Kernel/ Migrate/ MediaMigrationPlainTest.php - Tests the migration of plain file and image fields to media reference.
- MigrateMediaFromNonMediaSourceTest::testPlainFileToMediaMigration in tests/
src/ Functional/ MigrateMediaFromNonMediaSourceTest.php - Tests the result of the media migration.
File
- tests/
src/ Traits/ MediaMigrationAssertionsForNonMediaSourceTrait.php, line 152
Class
- MediaMigrationAssertionsForNonMediaSourceTrait
- Trait for non-media source to media migration tests.
Namespace
Drupal\Tests\media_migration\TraitsCode
protected function assertNonMediaToMedia7FieldValues() {
$media = $this->container
->get('entity_type.manager')
->getStorage('media')
->load(7);
assert($media instanceof MediaInterface);
$this
->assertEquals([
'mid' => [
[
'value' => '7',
],
],
'bundle' => [
[
'target_id' => 'image',
],
],
'name' => [
[
'value' => 'yellow.jpg',
],
],
'uid' => [
[
'target_id' => '2',
],
],
'status' => [
[
'value' => '1',
],
],
'created' => [
[
'value' => '1594368799',
],
],
'field_media_image' => [
[
'target_id' => '7',
'alt' => 'Alt for yellow.jpg',
'title' => NULL,
'width' => '640',
'height' => '400',
],
],
], $this
->getImportantEntityProperties($media));
// Check the media field.
$media_field = $this
->getReferencedEntities($media, 'field_media_image', 1);
assert($media_field[0] instanceof FileInterface);
// The referenced file should exist.
$this
->assertTrue(file_exists($media_field[0]
->getFileUri()));
}