You are here

protected function ALProfilesAPITest::getALProfilesAPI in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 acquia_lift_profiles/tests/acquia_lift_profiles_unit.test \ALProfilesAPITest::getALProfilesAPI()

Returns a ALProfilesAPI instance that can be used to test methods.

Parameters

bool $broken: Whether the HTTP client used by the API class should be broken, simulating 500 responses from Acquia Lift Profiles.

Return value

ALProfilesAPI A ALProfilesAPI instance.

4 calls to ALProfilesAPITest::getALProfilesAPI()
ALProfilesAPITest::testCanonicalizeRequest in acquia_lift_profiles/tests/acquia_lift_profiles_unit.test
Tests the method that canonicalizes a request into a string for signing.
ALProfilesAPITest::testDeleteEvent in acquia_lift_profiles/tests/acquia_lift_profiles_unit.test
Test ALProfilesAPI->deleteEvent()
ALProfilesAPITest::testGetSegements in acquia_lift_profiles/tests/acquia_lift_profiles_unit.test
ALProfilesAPITest::testSaveEvent in acquia_lift_profiles/tests/acquia_lift_profiles_unit.test
Test ALProfilesAPI->saveEvent()

File

acquia_lift_profiles/tests/acquia_lift_profiles_unit.test, line 367
Unit tests for Acquia Lift Profiles module.

Class

ALProfilesAPITest
@file Unit tests for Acquia Lift Profiles module.

Code

protected function getALProfilesAPI($broken = FALSE) {
  $acquia_lift_profiles_api = ALProfilesAPI::getInstance($this->accountName, $this->customerSite, $this->apiUrl, $this->accessKey, $this->secretKey);

  // Create a dummy http client for the Acquia Lift Profiles API to use. All
  // requests to it will be logged and retrievable for checking later.
  $this->httpClient = new DummyALProfilesHttpClient($broken);
  $acquia_lift_profiles_api
    ->setHttpClient($this->httpClient);
  if ($this->logger === NULL) {

    // Create a dummy logger instance which will maintain a log in memory
    // that we can retrieve for checking later.
    $this->logger = new AcquiaLiftTestLogger(FALSE);
  }
  $acquia_lift_profiles_api
    ->setLogger($this->logger);
  return $acquia_lift_profiles_api;
}