protected function AcquiaLiftTest::getAcquiaLiftAPI in Acquia Lift Connector 7.2
Same name and namespace in other branches
- 7 tests/AcquiaLiftAPI.test \AcquiaLiftTest::getAcquiaLiftAPI()
Returns a AcquiaLiftAPI 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.
array $data: An array of dummy data that can be returned in responses.
Return value
AcquiaLiftAPI A AcquiaLiftAPI instance.
6 calls to AcquiaLiftTest::getAcquiaLiftAPI()
- AcquiaLiftTest::testGetAgent in tests/
AcquiaLiftAPI.test - Test AcquiaLiftAPI->getAgent()
- AcquiaLiftTest::testGetCampaigns in tests/
AcquiaLiftAPI.test - Test AcquiaLiftAPI->getExistingAgents()
- AcquiaLiftTest::testPingTest in tests/
AcquiaLiftAPI.test - Test AcquiaLiftAPI->pingTest()
- AcquiaLiftTest::testSaveCampaign in tests/
AcquiaLiftAPI.test - Tests the saveCampaign method.
- AcquiaLiftTest::testSaveDecisionSet in tests/
AcquiaLiftAPI.test - Test AcquiaLiftAPI->saveDecisionSet()
File
- tests/
AcquiaLiftAPI.test, line 590 - Unit tests for Acquia Lift module.
Class
- AcquiaLiftTest
- @file Unit tests for Acquia Lift module.
Code
protected function getAcquiaLiftAPI($broken = FALSE, $data = array()) {
$lift_api = AcquiaLiftAPI::getInstance(array(
'api_url' => 'https://test-api.example.com',
'private_key' => $this->privateKey,
'public_key' => $this->publicKey,
'validate_response' => FALSE,
));
// Create a dummy http client for the Acquia Lift API to use. All
// requests to it will be logged and retrievable for checking later.
$this->httpClient = new DummyAcquiaLiftHttpClient($broken, $data);
$lift_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();
}
else {
$this->logger
->clearLogs();
}
$lift_api
->setLogger($this->logger);
return $lift_api;
}