public function AssetMediaFactoryTest::testGetMediaSource in Media: Acquia DAM 8
Validate we can get a media source based on an asset Id.
File
- tests/
src/ Unit/ AssetMediaFactoryTest.php, line 81
Class
- AssetMediaFactoryTest
- Class AssetMediaFactoryTest.
Namespace
Drupal\Tests\media_acquiadam\UnitCode
public function testGetMediaSource() {
$asset = $this
->getAssetData();
$this
->assertInstanceOf(MediaSourceInterface::class, $this->assetMediaFactory
->getMediaSource($asset->id));
$this
->assertInstanceOf(MediaSourceInterface::class, $this->assetMediaFactory
->getMediaSource($asset->id, 'acquiadam_asset'));
$this
->assertInstanceOf(MediaSourceInterface::class, $this->assetMediaFactory
->getMediaSource($asset->id, 'acquiadam_image'));
$this
->assertFalse($this->assetMediaFactory
->getMediaSource($asset->id, 'acquiadam_other'));
$this
->assertFalse($this->assetMediaFactory
->getMediaSource(FALSE));
$this
->assertFalse($this->assetMediaFactory
->getMediaSource(FALSE, 'acquiadam_asset'));
}