You are here

public function AssetMetadataHelperTest::testSetMetadataXmpFields in Media: Acquia DAM 8

Validate that we can set the available XMP metadata fields.

File

tests/src/Unit/AssetMetadataHelperTest.php, line 38

Class

AssetMetadataHelperTest
Tests integration of the AssetMetadataHelper service.

Namespace

Drupal\Tests\media_acquiadam\Unit

Code

public function testSetMetadataXmpFields() {
  $attributes = $this->assetMetadataHelper
    ->getMetadataAttributeLabels();
  $this
    ->assertArrayNotHasKey('xmp_example_field', $attributes);
  $this->assetMetadataHelper
    ->setMetadataXmpFields([
    'xmp_caption' => [
      'name' => 'Caption/Abstract',
      'label' => 'Caption/Description',
      'type' => 'textarea',
    ],
    'xmp_byline' => [
      'name' => 'By-line',
      'label' => 'Photographer',
      'type' => 'text',
    ],
  ]);
  $attributes = $this->assetMetadataHelper
    ->getMetadataAttributeLabels();
  $this
    ->assertArrayHasKey('xmp_byline', $attributes);
  $this
    ->assertArrayHasKey('xmp_caption', $attributes);
}