You are here

protected function AcquiadamAssetDataTrait::getAssetData in Media: Acquia DAM 8

Returns an Asset object for testing against.

Parameters

array $values: Extra values for the asset.

Return value

\cweagans\webdam\Entity\Asset A hard-coded Asset item.

15 calls to AcquiadamAssetDataTrait::getAssetData()
AcquiadamAssetTest::setUp in tests/src/Unit/AcquiadamAssetTest.php
AcquiadamMediaTest::setUp in tests/src/Kernel/AcquiadamMediaTest.php
AcquiadamMediaTest::testAssetFileIsCorrect in tests/src/Kernel/AcquiadamMediaTest.php
Tests if updating multiple revisionable entities.
AcquiadamNotificationTest::testNotifications in tests/src/Kernel/AcquiadamNotificationTest.php
Tests if assets are updated properly using notification sync.
AssetDataTest::testIsUpdatedAsset in tests/src/Unit/AssetDataTest.php
Validates that we can correctly determine if an asset has been updated.

... See full list

File

tests/src/Traits/AcquiadamAssetDataTrait.php, line 21

Class

AcquiadamAssetDataTrait
Shared asset data.

Namespace

Drupal\Tests\media_acquiadam\Traits

Code

protected function getAssetData(array $values = []) {
  $asset_info = $values + [
    'type' => 'asset',
    'id' => 3455969,
    'filename' => 'XAAAZZZZZ.jpg',
    'name' => 'Micro turbine 60',
    'filesize' => '0.07',
    'width' => 647,
    'height' => 433,
    'description' => 'micro-turbine, 60- or 100-kilowatt wind turbines',
    'filetype' => 'jpg',
    'colorspace' => 'RGB',
    'version' => 4,
    'type_id' => 1,
    'datecreated' => '2017-03-22 18:34:43',
    'date_created_unix' => '1490207683',
    'datemodified' => '2017-03-22 18:36:33',
    'date_modified_unix' => '1490207793',
    'datecaptured' => '2013-03-19 14:16:49',
    'datecapturedUnix' => '1363702609',
    'thumbnailurls' => [
      [
        'size' => 100,
        'url' => 'http://subdomain.webdamdb.com/s/100th_sm_0UerYozlI3.jpg',
      ],
      [
        'size' => 150,
        'url' => 'http://subdomain.webdamdb.com/s/150th_sm_0UerYozlI3.jpg',
      ],
      [
        'size' => 220,
        'url' => 'http://subdomain.webdamdb.com/s/220th_sm_0UerYozlI3.jpg',
      ],
      [
        'size' => 310,
        'url' => 'http://subdomain.webdamdb.com/s/310th_sm_0UerYozlI3.jpg',
      ],
      [
        'size' => 550,
        'url' => 'http://subdomain.webdamdb.com/s/md_0UerYozlI3.jpg',
      ],
    ],
    'folder' => [
      'type' => 'folder',
      'id' => 90754,
      'name' => "Jody's New Folder - Don't Touch",
    ],
    'user' => [
      'type' => 'user',
      'id' => 9750,
      'email' => 'jsmith@webdamdb.com',
      'name' => 'John Smith',
      'username' => 'myusername',
    ],
  ];
  $asset = Asset::fromJson(json_encode($asset_info));

  // XMP metadata must be set after the Asset object is created.
  $asset->xmp_metadata = [
    'caption' => [
      'name' => 'Caption/Abstract',
      'label' => 'Caption/Description',
      'type' => 'textarea',
      'value' => 'XMP Caption',
    ],
    'byline' => [
      'name' => 'By-line',
      'label' => 'Photographer',
      'type' => 'text',
      'value' => 'XMP Byline',
    ],
  ];
  return $asset;
}