You are here

protected function ServicesWebTestCase::servicesGet in Services 6.3

Same name and namespace in other branches
  1. 7.3 tests/services.test \ServicesWebTestCase::servicesGet()
10 calls to ServicesWebTestCase::servicesGet()
ServicesEndpointTests::saveNewEndpoint in tests/functional/ServicesEndpointTests.test
ServicesResourceCommentTests::testCommentRetrieve in tests/functional/ServicesResourceCommentTests.test
Test retrieve method.
ServicesResourceFileTests::testResourceFileRetrieve in tests/functional/ServicesResourceFileTests.test
Test retrieve method.
ServicesResourceNodetests::testCommentLoadNodeComments in tests/functional/ServicesResourceNodeTests.test
Test loadNodeComments method.
ServicesResourceNodetests::testNewEndpointResourceNodeGet in tests/functional/ServicesResourceNodeTests.test
testing node_resource Get

... See full list

File

tests/functional/ServicesWebTestCase.php, line 9
Services base testing class.

Class

ServicesWebTestCase
@file Services base testing class.

Code

protected function servicesGet($url, $data = NULL, $headers = array()) {
  $options = array(
    'query' => $data,
  );
  $url = url($this
    ->getAbsoluteUrl($url) . '.php', $options);
  $headers = array();
  $content = $this
    ->curlExec(array(
    CURLOPT_HTTPGET => TRUE,
    CURLOPT_URL => $url,
    CURLOPT_NOBODY => FALSE,
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_HEADER => TRUE,
    CURLOPT_HTTPHEADER => $headers,
  ));

  // Parse response.
  list($info, $header, $status, $code, $body) = $this
    ->parseHeader($content);
  $this
    ->verbose('GET request to: ' . $url . '<hr />Arguments: ' . highlight_string('<?php ' . var_export($data, TRUE), TRUE) . '<hr />Response: ' . highlight_string('<?php ' . var_export($body, TRUE), TRUE) . '<hr />Raw response: ' . $content);
  return array(
    'header' => $header,
    'status' => $status,
    'code' => $code,
    'body' => $body,
  );
}