You are here

protected function AcquiadamMediaTest::clearCurrentAssetFromSource in Media: Acquia DAM 8

Clears source current asset so we can simulate updates from the API.

Parameters

\Drupal\media_acquiadam\Plugin\media\Source\AcquiadamAsset $source: The source to clear.

1 call to AcquiadamMediaTest::clearCurrentAssetFromSource()
AcquiadamMediaTest::reSaveMedia in tests/src/Kernel/AcquiadamMediaTest.php
Re-saves the media to get new updates.

File

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

Class

AcquiadamMediaTest
Tests Media entities with Media: Acquia DAM source.

Namespace

Drupal\Tests\media_acquiadam\Kernel

Code

protected function clearCurrentAssetFromSource(AcquiadamAsset $source) {
  $current_asset_property = $this->sourceReflectionClass
    ->getProperty('currentAsset');
  $current_asset_property
    ->setAccessible(TRUE);
  $current_asset_property
    ->setValue($source, NULL);
  $cached_assets_property = $this->acquiadamReflectionClass
    ->getProperty('cachedAssets');
  $cached_assets_property
    ->setAccessible(TRUE);
  $cached_assets_property
    ->setValue([]);
}