You are here

protected function AcquiaLiftTest::assertConfidenceReportAPI in Acquia Lift Connector 7

Helper function to call the confidence report endpoint and verify the API request.

Parameters

$params: The indexed parameter array to pass to the api call.

$request: The expected request values.

$lift_api: (Optional) the lift api instance to use for tests.

1 call to AcquiaLiftTest::assertConfidenceReportAPI()
AcquiaLiftTest::testGetConfidenceReport in tests/AcquiaLiftAPI.test
Test AcquiaLiftAPI->getConfidenceReport()

File

tests/AcquiaLiftAPI.test, line 2034
Unit tests for Acquia Lift module.

Class

AcquiaLiftTest
@file Unit tests for Acquia Lift module.

Code

protected function assertConfidenceReportAPI($params, $request, $lift_api) {
  $logs = array();
  if (empty($lift_api)) {
    $lift_api = $this
      ->getAcquiaLiftAPI();
  }
  try {
    call_user_func_array(array(
      $lift_api,
      'getConfidenceReport',
    ), $params);
  } catch (Exception $e) {
    $logs = array(
      array(
        'level' => PersonalizeLogLevel::ERROR,
        'message' => 'Problem retrieving confidence report.',
      ),
    );
    $this
      ->assertTrue($e instanceof AcquiaLiftException);
  }
  $this
    ->assertAPIRequests(array(
    $request,
  ));
  $this
    ->assertLogs($logs);
}