public function AssetMediaFactoryTest::testGetMediaEntity in Media: Acquia DAM 8
Validate we can get a media entity from an asset ID.
File
- tests/
src/ Unit/ AssetMediaFactoryTest.php, line 99
Class
- AssetMediaFactoryTest
- Class AssetMediaFactoryTest.
Namespace
Drupal\Tests\media_acquiadam\UnitCode
public function testGetMediaEntity() {
$asset = $this
->getAssetData();
$this
->assertInstanceOf(MediaInterface::class, $this->assetMediaFactory
->getMediaEntity($asset->id));
$this
->assertInstanceOf(MediaInterface::class, $this->assetMediaFactory
->getMediaEntity($asset->id, 'acquiadam_asset'));
$this
->assertFalse($this->assetMediaFactory
->getMediaEntity($asset->id, 'acquiadam_other'));
$this
->assertFalse($this->assetMediaFactory
->getMediaEntity(FALSE, 'acquiadam_asset'));
}