$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
);
// Process the queue item and make sure that the thumbnail was updated too.
$queue_name = 'media_entity_thumbnail';
/** @var \Drupal\Core\Queue\QueueWorkerInterface $queue_worker */
$queue_worker = \Drupal::
service('plugin.manager.queue_worker'
)->
createInstance($queue_name);
$queue = \Drupal::
queue($queue_name);
$this->
assertSame(1,
$queue->
numberOfItems(), 'Item was not added to the queue.'
);
$item =
$queue->
claimItem();
$this->
assertSame($media->
id(),
$item->data
['id'
], 'Queue item that was created does not belong to the correct entity.'
);
$queue_worker->
processItem($item->data
);
$queue->
deleteItem($item);
$this->
assertSame(0,
$queue->
numberOfItems(), 'Item was not removed from the queue.'
);
$media = Media::
load($media->
id());
$this->
assertSame('public://thumbnail1.jpg',
$media->thumbnail->entity->
getFileUri(), 'Thumbnail was not updated by the queue.'
);
$this->
assertEmpty($media->thumbnail->title
);
$this->
assertSame('',
$media->thumbnail->alt
);