public function AcquiaLiftTest::testGetTargetingImpactReport in Acquia Lift Connector 7
Test AcquiaLiftAPI->getTargetingImpactReport() @todo test with 'point' value
File
- tests/
AcquiaLiftAPI.test, line 1234 - Unit tests for Acquia Lift module.
Class
- AcquiaLiftTest
- @file Unit tests for Acquia Lift module.
Code
public function testGetTargetingImpactReport() {
$lift_api = $this
->getAcquiaLiftAPI();
$agentName = 'some-agent-name';
$dateStr = date('Y-m-d');
$lift_api
->getTargetingImpactReport($agentName);
// Define the requests we expect to have been made to our dummy http
// client for this operation.
$requests = array(
array(
'type' => 'get',
'uri' => "{$lift_api->getApiUrl()}/{$lift_api->getOwnerCode()}/{$agentName}/report/targeting-features/{$dateStr}?apikey={$lift_api->getAdminKey()}",
'headers' => array(
'Accept' => 'application/json',
),
'options' => array(),
'body' => NULL,
),
);
// Confirm the expected requests were made.
$this
->assertAPIRequests($requests);
$logs = array();
$this
->assertLogs($logs);
$startDate = '2014-01-01';
$endDate = '2014-01-02';
$lift_api
->getTargetingImpactReport($agentName, $startDate, $endDate);
// Define the requests we expect to have been made to our dummy http
// client for this operation.
$requests = array(
array(
'type' => 'get',
'uri' => "{$lift_api->getApiUrl()}/{$lift_api->getOwnerCode()}/{$agentName}/report/targeting-features/{$startDate}/{$endDate}?apikey={$lift_api->getAdminKey()}",
'headers' => array(
'Accept' => 'application/json',
),
'options' => array(),
'body' => NULL,
),
);
// Confirm the expected requests were made.
$this
->assertAPIRequests($requests);
$logs = array();
$this
->assertLogs($logs);
$lift_api = $this
->getAcquiaLiftAPI(TRUE);
try {
$lift_api
->getTargetingImpactReport($agentName, $startDate, $endDate);
} catch (Exception $e) {
$this
->assertTrue($e instanceof AcquiaLiftException);
}
// Confirm the expected requests were made.
$this
->assertAPIRequests($requests);
$logs = array(
array(
'level' => PersonalizeLogLevel::ERROR,
'message' => 'Problem retrieving targeting impact report.',
),
);
$this
->assertLogs($logs);
}