You are here

public function AcquiadamMediaTest::testFieldMappings in Media: Acquia DAM 8

Tests if field mappings work as expected.

File

tests/src/Kernel/AcquiadamMediaTest.php, line 70

Class

AcquiadamMediaTest
Tests Media entities with Media: Acquia DAM source.

Namespace

Drupal\Tests\media_acquiadam\Kernel

Code

public function testFieldMappings() {
  $media_description = $this->media
    ->get('field_acquiadam_asset_descrip')
    ->getString();
  $media_file_uri = $this
    ->getAssetFileEntity($this->media)
    ->getFileUri();
  $expected_asset_uri = $this
    ->getAssetUri($this->asset, $this->media);
  $this
    ->assertEqual($this->media
    ->label(), $this->asset->filename, 'Media name mapped to asset filename as expected.');
  $this
    ->assertEqual($media_description, $this->asset->description, 'Media description mapped to asset description as expected.');
  $this
    ->assertEqual($media_file_uri, $expected_asset_uri, 'Media file URI mapped as expected.');
}