You are here

public function AcquiadamServiceTest::testStaticAssetCache in Media: Acquia DAM 8

Validate the static cache helper works as expected.

File

tests/src/Unit/AcquiadamServiceTest.php, line 42

Class

AcquiadamServiceTest
Acquia DAM REST extension tests.

Namespace

Drupal\Tests\media_acquiadam\Unit

Code

public function testStaticAssetCache() {
  $asset = $this
    ->getAssetData();
  $this
    ->assertNull($this->acquiaDamClient
    ->staticAssetCache('get', $asset->id));
  $this->acquiaDamClient
    ->staticAssetCache('set', $asset->id, FALSE);
  $this
    ->assertFalse($this->acquiaDamClient
    ->staticAssetCache('get', $asset->id));
  $this->acquiaDamClient
    ->staticAssetCache('set', $asset->id, $asset);
  $this
    ->assertInstanceOf(Asset::class, $this->acquiaDamClient
    ->staticAssetCache('get', $asset->id));
  $this->acquiaDamClient
    ->staticAssetCache('clear');
  $this
    ->assertNull($this->acquiaDamClient
    ->staticAssetCache('get', $asset->id));
}