public function AcquiaLiftTest::testGetGoalsForAgent in Acquia Lift Connector 7
Test AcquiaLiftAPI->getGoalsForAgent()
File
- tests/
AcquiaLiftAPI.test, line 740 - Unit tests for Acquia Lift module.
Class
- AcquiaLiftTest
- @file Unit tests for Acquia Lift module.
Code
public function testGetGoalsForAgent() {
$lift_api = $this
->getAcquiaLiftAPI();
$agentName = 'some_machine_name';
$lift_api
->getGoalsForAgent($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()}/agent-api/{$agentName}/goals?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
->getGoalsForAgent($agentName);
$this
->fail('Should not reach here');
} catch (AcquiaLiftException $e) {
}
// Confirm the expected requests and logs.
$this
->assertAPIRequests($requests);
$logs = array();
$this
->assertLogs($logs);
}