You are here

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

Tests updating media entity when new version is available.

File

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

Class

AcquiadamMediaTest
Tests Media entities with Media: Acquia DAM source.

Namespace

Drupal\Tests\media_acquiadam\Kernel

Code

public function testNewVersionUpdate() {

  /** @var \Drupal\media_acquiadam\AssetData $asset_data */
  $asset_data = $this->container
    ->get('media_acquiadam.asset_data');
  $this
    ->saveNewVersion();
  $file = $this
    ->getAssetFileEntity($this->media);
  $file_uri = $file
    ->getFileUri();
  $expected_asset_uri = $this
    ->getAssetUri($this->asset, $this->media);
  $new_version = $asset_data
    ->get($this->asset->id, 'version');
  $this
    ->assertEqual($this->media
    ->label(), $this->asset->filename, 'Media name updated as expected.');
  $this
    ->assertEqual($file_uri, $expected_asset_uri, 'Media asset file updated as expected.');
  $this
    ->assertEqual($file
    ->label(), $this->asset->filename, 'File entity label updated as expected.');
  $this
    ->assertEqual($this->asset->version, $new_version, 'Asset version updated as expected.');
}