You are here

protected function ThunderTestTrait::loadMediaByUuid in Thunder 6.2.x

Same name and namespace in other branches
  1. 6.1.x tests/src/Traits/ThunderTestTrait.php \Drupal\Tests\thunder\Traits\ThunderTestTrait::loadMediaByUuid()

Load media by UUID.

Parameters

string $uuid: The uuid.

Return value

\Drupal\media\MediaInterface|false|null The media entity.

Throws

\Drupal\Core\Entity\EntityStorageException

8 calls to ThunderTestTrait::loadMediaByUuid()
ArticleCreationTest::testCreateArticle in tests/src/FunctionalJavascript/ArticleCreationTest.php
Test Creation of Article.
ChannelsTagsTest::testChannelsCreation in tests/src/FunctionalJavascript/ChannelsTagsTest.php
Test channel creation, tagging of articles and channel page with articles.
MediaGalleryModifyTest::testAddRemove in tests/src/FunctionalJavascript/MediaGalleryModifyTest.php
Test add/remove Images in Gallery.
MediaGalleryModifyTest::testOrderChange in tests/src/FunctionalJavascript/MediaGalleryModifyTest.php
Test order change for Gallery.
MediaImageModifyTest::testFocalPointChange in tests/src/FunctionalJavascript/MediaImageModifyTest.php
Test Focal Point change.

... See full list

File

tests/src/Traits/ThunderTestTrait.php, line 186

Class

ThunderTestTrait
Use this trait to reuse an existing database.

Namespace

Drupal\Tests\thunder\Traits

Code

protected function loadMediaByUuid($uuid) {
  $media = \Drupal::getContainer()
    ->get('entity.repository')
    ->loadEntityByUuid('media', $uuid);
  assert($media instanceof MediaInterface);
  return $media;
}