You are here

public function ThumbnailTest::testLocalImageNotPresent in Media entity Twitter 8.2

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

Tests that a local image is downloaded if available but not present.

File

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

Class

ThumbnailTest
Tests SVG thumbnail generation from Twitter API responses.

Namespace

Drupal\Tests\media_entity_twitter\Kernel

Code

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