You are here

protected function MigrateMediaTestBase::getEntityStorage in Media Migration 8

Returns the specified entity's storage when the entity definition exists.

Parameters

string $entity_type_id: The entity type ID.

Return value

\Drupal\Core\Entity\EntityStorageInterface|null The embed button's entity storage, or NULL if it does not exist.

3 calls to MigrateMediaTestBase::getEntityStorage()
MigrateEmbedMediaTokenToEntityEmbedTest::testMediaTokenToEntityEmbedTransform in tests/src/Functional/MigrateEmbedMediaTokenToEntityEmbedTest.php
Tests the result of Media Migration's embed media token transform.
MigrateMediaTestBase::assertEntities in tests/src/Functional/MigrateMediaTestBase.php
Asserts that the expected entities exist.
MigrateMediaTestBase::setUp in tests/src/Functional/MigrateMediaTestBase.php

File

tests/src/Functional/MigrateMediaTestBase.php, line 655

Class

MigrateMediaTestBase
Provides a base class for testing media migration via the UI.

Namespace

Drupal\Tests\media_migration\Functional

Code

protected function getEntityStorage(string $entity_type_id) {
  $entity_type_manager = $this->container
    ->get('entity_type.manager');
  assert($entity_type_manager instanceof EntityTypeManagerInterface);
  try {
    $storage = $entity_type_manager
      ->getStorage($entity_type_id);
  } catch (PluginNotFoundException $e) {

    // The entity type does not exist.
    return NULL;
  }
  return $storage;
}