You are here

class TestClient in Media: Acquia DAM 8

Overridden implementation of the Acquia DAM client for testing.

Hierarchy

Expanded class hierarchy of TestClient

1 file declares its use of TestClient
AcquiadamKernelTestBase.php in tests/src/Kernel/AcquiadamKernelTestBase.php

File

tests/modules/media_acquiadam_test/src/TestClient.php, line 10

Namespace

Drupal\media_acquiadam_test
View source
class TestClient {

  /**
   * Array with test asset data.
   *
   * @var array
   */
  protected $testAssets = [];

  /**
   * Array with test notifications.
   *
   * @var array
   */
  protected $notifications = [];

  /**
   * Test data for Active XMP fields.
   *
   * @return array
   *   An empty array.
   */
  public function getActiveXmpFields() {
    return [];
  }

  /**
   * Add a test notification.
   *
   * @param array $notification
   *   The test notification to add.
   */
  public function addNotification(array $notification) {
    $this->notifications[] = $notification;
  }

  /**
   * Returns the notifications with the expected format.
   *
   * @return array
   *   The notifications with the expected format.
   */
  public function getNotifications() {
    return [
      'total' => count($this->notifications),
      'notifications' => $this->notifications,
    ];
  }

  /**
   * Add or modify a test asset.
   *
   * @param \cweagans\webdam\Entity\Asset $asset
   *   The asset to add/modify.
   */
  public function addAsset(Asset $asset) {
    $this->testAssets[$asset->id] = $asset;
  }

  /**
   * Get a test Asset given an Asset ID.
   *
   * @param int $assetId
   *   The test Asset ID.
   *
   * @return \cweagans\webdam\Entity\Asset
   *   The test asset.
   */
  public function getAsset($assetId) {
    return $this->testAssets[$assetId];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TestClient::$notifications protected property Array with test notifications.
TestClient::$testAssets protected property Array with test asset data.
TestClient::addAsset public function Add or modify a test asset.
TestClient::addNotification public function Add a test notification.
TestClient::getActiveXmpFields public function Test data for Active XMP fields.
TestClient::getAsset public function Get a test Asset given an Asset ID.
TestClient::getNotifications public function Returns the notifications with the expected format.