You are here

protected function MediaEntityHelperTest::getNewMediaEntityHelper in Media: Acquia DAM 8

Gets an instance of the MediaEntityHelper class.

Parameters

\Drupal\media\MediaInterface|null $media: The media entity to wrap.

Return value

\Drupal\media_acquiadam\MediaEntityHelper An instance of the MediaEntityHelper class.

1 call to MediaEntityHelperTest::getNewMediaEntityHelper()
MediaEntityHelperTest::testGetFile in tests/src/Unit/MediaEntityHelperTest.php
Validate we can get file from a media entity.

File

tests/src/Unit/MediaEntityHelperTest.php, line 144

Class

MediaEntityHelperTest
Testing of the Media Entity helper class.

Namespace

Drupal\Tests\media_acquiadam\Unit

Code

protected function getNewMediaEntityHelper(MediaInterface $media = NULL) {
  if (is_null($media)) {
    $media = $this
      ->getMockedMediaEntity($this
      ->getAssetData()->id);
  }
  return new MediaEntityHelper($media, $this->container
    ->get('entity_type.manager'), $this->container
    ->get('media_acquiadam.asset_data'), $this->container
    ->get('media_acquiadam.acquiadam'), $this->container
    ->get('media_acquiadam.asset_file.helper'));
}