You are here

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

Validate we can get an existing fild ID if one is present.

File

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

Class

MediaEntityHelperTest
Testing of the Media Entity helper class.

Namespace

Drupal\Tests\media_acquiadam\Unit

Code

public function testGetExistingFileId() {
  $this
    ->assertEquals($this
    ->getMockedFileEntity()
    ->id(), $this
    ->getNewMediaEntityHelper()
    ->getExistingFileId());

  /** @var \Drupal\media\MediaInterface|\PHPUnit\Framework\MockObject\MockObject $media */
  $media = $this
    ->getMockBuilder(MediaInterface::class)
    ->disableOriginalConstructor()
    ->getMock();
  $this
    ->assertFalse($this
    ->getNewMediaEntityHelper($media)
    ->getExistingFileId());
}