You are here

public function MediaEntityHelperTest::testGetExistingFile in Media: Acquia DAM 8

Validate we can properly load an existing file.

File

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

Class

MediaEntityHelperTest
Testing of the Media Entity helper class.

Namespace

Drupal\Tests\media_acquiadam\Unit

Code

public function testGetExistingFile() {
  $this
    ->assertInstanceOf(FileInterface::class, $this
    ->getNewMediaEntityHelper()
    ->getExistingFile());
  $media = $this
    ->getMockBuilder(MediaInterface::class)
    ->disableOriginalConstructor()
    ->getMock();

  /** @var \Drupal\media\MediaInterface|\PHPUnit\Framework\MockObject\MockObject $media */
  $this
    ->assertFalse($this
    ->getNewMediaEntityHelper($media)
    ->getExistingFile());
}