You are here

function AcquiaLiftWebTestReports::testPerGoalReport in Acquia Lift Connector 7

File

tests/acquia_lift.test, line 2415
Integration tests for Acquia Lift module.

Class

AcquiaLiftWebTestReports

Code

function testPerGoalReport() {
  AcquiaLiftAPI::setTestInstance();
  $agent = $this
    ->createTestAgent();
  $this
    ->resetAll();
  DummyAcquiaLiftHttpClient::clearLoggedRequests();

  // Call the conversion report specifying a particular goal.
  $agent
    ->buildConversionReport(array(
    'goal' => 'user_login',
  ));
  $requests = DummyAcquiaLiftHttpClient::getLoggedRequests();
  $this
    ->assertEqual(2, count($requests));
  $agent_name = $agent
    ->getMachineName();
  $date = date('Y-m-d');

  // Confirm that the report requests made include the goal in the parameters.
  $summary_url = "http://api.example.com/test-owner-code/{$agent_name}/report/confidence/{$date}/{$date}?features=&apikey=test-admin-key&confidence-measure=0.95&aggregated-over-dates=true&goal=user_login&policies=explore";
  $detail_url = "http://api.example.com/test-owner-code/{$agent_name}/report/confidence/{$date}/{$date}?features=&apikey=test-admin-key&confidence-measure=0.95&aggregated-over-dates=false&goal=user_login&policies=explore";
  $this
    ->assertEqual($summary_url, $requests[0]['uri']);
  $this
    ->assertEqual($detail_url, $requests[1]['uri']);
}