You are here

public function AcquiaLiftTest::testGetDecisionsForPoint in Acquia Lift Connector 7

Test AcquiaLiftAPI->getDecisionsForPoint()

File

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

Class

AcquiaLiftTest
@file Unit tests for Acquia Lift module.

Code

public function testGetDecisionsForPoint() {
  $lift_api = $this
    ->getAcquiaLiftAPI();
  $agentName = 'some_machine_name';
  $pointName = 'some_point_name';
  $lift_api
    ->getDecisionsForPoint($agentName, $pointName);

  // 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?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
      ->getDecisionsForPoint($agentName, $pointName);
    $this
      ->fail('Should not reach here');
  } catch (AcquiaLiftException $e) {
  }

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