protected function ServicesWebTestCase::servicesGet in Services 7.3
Same name and namespace in other branches
- 6.3 tests/functional/ServicesWebTestCase.php \ServicesWebTestCase::servicesGet()
Perform GET request.
15 calls to ServicesWebTestCase::servicesGet()
- ServicesAliasTests::testUnderscoreAlias in tests/
functional/ ServicesAliasTests.test - Testing parser functionality.
- ServicesArgumentsTestCase::testPathArguments in tests/
functional/ ServicesArgumentsTests.test - Test two path arguments of
- ServicesResourceCommentTests::testCommentIndex in tests/
functional/ ServicesResourceCommentTests.test - ServicesResourceCommentTests::testCommentRetrieve in tests/
functional/ ServicesResourceCommentTests.test - Test retrieve method.
- ServicesResourceFileTests::testIndexFiles in tests/
functional/ ServicesResourceFileTests.test
File
- tests/
services.test, line 26
Class
Code
protected function servicesGet($url, $data = NULL, $headers = array()) {
$options = array(
'query' => $data,
);
$url = url($this
->getAbsoluteUrl($url) . '.php', $options);
$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 />headers: ' . highlight_string('<?php ' . var_export($headers, TRUE), TRUE) . '<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,
);
}