You are here

public function ThumbnailTest::testLocalImagePresent in Media entity Twitter 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/ThumbnailTest.php \Drupal\Tests\media_entity_twitter\Kernel\ThumbnailTest::testLocalImagePresent()

Tests that an existing local image is used as the thumbnail.

File

tests/src/Kernel/ThumbnailTest.php, line 116

Class

ThumbnailTest
Tests SVG thumbnail generation from Twitter API responses.

Namespace

Drupal\Tests\media_entity_twitter\Kernel

Code

public function testLocalImagePresent() {
  $this->tweetFetcher
    ->method('fetchTweet')
    ->willReturn([
    'extended_entities' => [
      'media' => [
        [
          'media_url' => 'https://drupal.org/favicon.ico',
        ],
      ],
    ],
  ]);
  $uri = 'public://twitter-thumbnails/12345.ico';
  touch($uri);
  $this
    ->assertEquals($uri, $this->plugin
    ->thumbnail($this->entity));
}