You are here

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

Validates that we can get the asset ID.

File

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

Class

MediaEntityHelperTest
Testing of the Media Entity helper class.

Namespace

Drupal\Tests\media_acquiadam\Unit

Code

public function testGetAssetId() {
  $this
    ->assertEquals($this
    ->getAssetData()->id, $this
    ->getNewMediaEntityHelper()
    ->getAssetId());

  // Change our source field to simulate a missing asset.
  $media = $this
    ->getMockedMediaEntity($this
    ->getAssetData()->id, 'phpunit_test_fail');
  $this
    ->assertFalse($this
    ->getNewMediaEntityHelper($media)
    ->getAssetId());
}