You are here

public function AcquiaLiftTest::testGetChoicesForDecision in Acquia Lift Connector 7

Test AcquiaLiftAPI->getChoicesForDecision()

File

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

Class

AcquiaLiftTest
@file Unit tests for Acquia Lift module.

Code

public function testGetChoicesForDecision() {
  $lift_api = $this
    ->getAcquiaLiftAPI();
  $agentName = 'some_machine_name';
  $pointName = 'some_point_name';
  $decisionName = 'some_decision_name';
  $lift_api
    ->getChoicesForDecision($agentName, $pointName, $decisionName);

  // 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()}/agent-api/{$agentName}/points/{$pointName}/decisions/{$decisionName}/choices?apikey={$lift_api->getAdminKey()}",
      'headers' => array(
        'Accept' => 'application/json',
      ),
      'options' => array(),
      'body' => NULL,
    ),
  );

  // Confirm the expected requests and logs.
  $this
    ->assertAPIRequests($requests);
  $logs = array();
  $this
    ->assertLogs($logs);
  $lift_api = $this
    ->getAcquiaLiftAPI(TRUE);
  try {
    $lift_api
      ->getChoicesForDecision($agentName, $pointName, $decisionName);
    $this
      ->fail('Should not reach here');
  } catch (AcquiaLiftException $e) {
  }

  // Confirm the expected requests and logs.
  $this
    ->assertAPIRequests($requests);
  $logs = array();
  $this
    ->assertLogs($logs);
}