$media->
save();
$this->
assertSame(1024,
$media->thumbnail->width
);
$this->
assertSame(768,
$media->thumbnail->height
);
// Enable queued thumbnails and make sure that the entity gets the default
// thumbnail initially.
\Drupal::
state()->
set('media_source_test_definition',
[]);
\Drupal::
state()->
set('media_source_test_attributes',
[ 'thumbnail_uri' =>
['value' => 'public://thumbnail1.jpg'
],
]);
$this->testMediaType->
setQueueThumbnailDownloadsStatus(TRUE
)->
save();
$media = Media::
create([ 'bundle' =>
$this->testMediaType->
id(),
'name' => 'Mr. Jones',
'field_media_test' => 'some_value',
]);
$this->
assertSame('public://thumbnail1.jpg',
$media->
getSource()->
getMetadata($media, 'thumbnail_uri'
), 'Value of the metadata attribute is not correct.'
);
$media->
save();
$this->
assertSame('public://media-icons/generic/generic.png',
$media->thumbnail->entity->
getFileUri(), 'Default thumbnail was not set initially.'
);
$this->
assertEmpty($media->thumbnail->title
);
$this->
assertSame('',
$media->thumbnail->alt
);