You are here

protected function DummyAcquiaLiftHttpClient::generateDummyResponse in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 tests/acquia_lift.test_classes.inc \DummyAcquiaLiftHttpClient::generateDummyResponse()

Generates a dummy response based on the passed in data.

Parameters

array $data: An array of data for the response.

Return value

stdClass An object representing a response from the server.

5 calls to DummyAcquiaLiftHttpClient::generateDummyResponse()
DummyAcquiaLiftHttpClient::delete in tests/acquia_lift.test_classes.inc
Implements AcquiaLiftDrupalHttpClientInterface::delete().
DummyAcquiaLiftHttpClient::get in tests/acquia_lift.test_classes.inc
Implements AcquiaLiftDrupalHttpClientInterface::get().
DummyAcquiaLiftHttpClient::post in tests/acquia_lift.test_classes.inc
Implements AcquiaLiftDrupalHttpClientInterface::post().
DummyAcquiaLiftHttpClient::put in tests/acquia_lift.test_classes.inc
Implements AcquiaLiftDrupalHttpClientInterface::put().
DummyALProfilesHttpClient::get in acquia_lift_profiles/tests/acquia_lift_profiles.test_classes.inc
Implements AcquiaLiftDrupalHttpClientInterface::get().

File

tests/acquia_lift.test_classes.inc, line 49
Provides test classes for Acquia Lift

Class

DummyAcquiaLiftHttpClient
Classes used for testing.

Code

protected function generateDummyResponse($data) {
  $response = new stdClass();
  $response->code = 200;
  $response->status_message = 'OK';
  if ($this->broken) {
    if ($this->breakageType == 'client') {
      $response->code = 400;
      $response->status_message = 'Bad request';
    }
    else {
      $response->code = 500;
      $response->status_message = 'Internal Server Error';
    }
  }
  $response->data = drupal_json_encode($data);
  return $response;
}