public function MediaEntityHelperTest::testGetFile in Media: Acquia DAM 8
Validate we can get file from a media entity.
File
- tests/
src/ Unit/ MediaEntityHelperTest.php, line 38
Class
- MediaEntityHelperTest
- Testing of the Media Entity helper class.
Namespace
Drupal\Tests\media_acquiadam\UnitCode
public function testGetFile() {
$helper = $this
->getNewMediaEntityHelper();
$this
->assertInstanceOf(FileInterface::class, $helper
->getFile());
// Change the source field to a failing one to simulate a missing file.
$media = $this
->getMockedMediaEntity($this
->getAssetData()->id, 'phpunit_test_fail');
$this
->assertFalse($this
->getNewMediaEntityHelper($media)
->getFile());
}