You are here

public function AssetMediaFactoryTest::testGetFileEntity in Media: Acquia DAM 8

Validate we can get a file entity for an asset.

File

tests/src/Unit/AssetMediaFactoryTest.php, line 172

Class

AssetMediaFactoryTest
Class AssetMediaFactoryTest.

Namespace

Drupal\Tests\media_acquiadam\Unit

Code

public function testGetFileEntity() {
  $asset = $this
    ->getAssetData();
  $this
    ->assertInstanceOf(FileInterface::class, $this->assetMediaFactory
    ->getFileEntity($asset->id));
  $this
    ->assertInstanceOf(FileInterface::class, $this->assetMediaFactory
    ->getFileEntity($asset->id, 'acquiadam_asset'));
  $this
    ->assertInstanceOf(FileInterface::class, $this->assetMediaFactory
    ->getFileEntity($asset->id, 'acquiadam_image'));
  $this
    ->assertFalse($this->assetMediaFactory
    ->getFileEntity(FALSE));
  $this
    ->assertFalse($this->assetMediaFactory
    ->getFileEntity($asset->id, 'acquiadam_other'));
}