You are here

public function DocumentBundleTest::getMostRecentThumbnail in D7 Media 8

Returns the thumbnail of the most recent document.

Return value

string Path of the thumbnail.

1 call to DocumentBundleTest::getMostRecentThumbnail()
DocumentBundleTest::testDocumentItemThumbnail in src/Tests/DocumentBundleTest.php
Tests thumbnails of the document items.

File

src/Tests/DocumentBundleTest.php, line 128

Class

DocumentBundleTest
Ensures that media bundle for document can be created.

Namespace

Drupal\media\Tests

Code

public function getMostRecentThumbnail() {
  $document_id = $this->container
    ->get('entity.query')
    ->get('media')
    ->condition('bundle', 'document')
    ->sort('created', 'DESC')
    ->execute();
  $item = $this->container
    ->get('entity_type.manager')
    ->getStorage('media')
    ->loadUnchanged(reset($document_id));
  return $item
    ->getType()
    ->thumbnail($item);
}