You are here

public function ProvidedFieldsTest::testDefaultThumbnail in Video Embed Field 8.2

Same name and namespace in other branches
  1. 8 modules/video_embed_media/tests/src/Kernel/ProvidedFieldsTest.php \Drupal\Tests\video_embed_media\Kernel\ProvidedFieldsTest::testDefaultThumbnail()

Test the default thumbnail.

File

modules/video_embed_media/tests/src/Kernel/ProvidedFieldsTest.php, line 81

Class

ProvidedFieldsTest
Test the provided fields.

Namespace

Drupal\Tests\video_embed_media\Kernel

Code

public function testDefaultThumbnail() {
  $source_field = $this->plugin
    ->getSourceFieldDefinition($this->entityType);
  $field_name = $source_field
    ->getName();
  $entity = Media::create([
    'bundle' => $this->entityType
      ->id(),
    $field_name => [
      [
        'value' => 'https://vimeo.com/channels/staffpicks/153786080-fake-url',
      ],
    ],
  ]);
  $this
    ->assertEquals('public://media-icons/generic/video.png', $this->plugin
    ->getMetadata($entity, 'thumbnail_uri'));
}