protected function ServicesWebTestCase::servicesPut in Services 6.3
Same name and namespace in other branches
- 7.3 tests/services.test \ServicesWebTestCase::servicesPut()
12 calls to ServicesWebTestCase::servicesPut()
- ServicesResourceCommentTests::testCommentUpdate in tests/
functional/ ServicesResourceCommentTests.test - Test update method.
- ServicesResourceCommentTests::testCommentUpdateLegacy in tests/
functional/ ServicesResourceCommentTests.test - Test update method (Legacy).
- ServicesResourceNodetests::testEndpointResourceNodeUpdate in tests/
functional/ ServicesResourceNodeTests.test - Testing node_resource Update
- ServicesResourceNodetests::testEndpointResourceNodeUpdateLegacy in tests/
functional/ ServicesResourceNodeTests.test - Testing node_resource Update (Legacy).
- ServicesResourceNodetests::testEndpointResourceNodeUpdateMissingTitle in tests/
functional/ ServicesResourceNodeTests.test - testing node_resource Update verify missing title
File
- tests/
functional/ ServicesWebTestCase.php, line 73 - Services base testing class.
Class
- ServicesWebTestCase
- @file Services base testing class.
Code
protected function servicesPut($url, $data = NULL, $headers = array()) {
$options = array();
$url = $this
->getAbsoluteUrl($url) . '.php';
$serialize_args = serialize($data);
// Set up headers so arguments will be unserialized.
$headers = array(
"Content-type: application/vnd.php.serialized; charset=iso-8859-1",
);
// Emulate file.
$putData = fopen('php://memory', 'rw+');
fwrite($putData, $serialize_args);
fseek($putData, 0);
$content = $this
->curlExec(array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_PUT => TRUE,
CURLOPT_HEADER => TRUE,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_INFILE => $putData,
CURLOPT_INFILESIZE => drupal_strlen($serialize_args),
));
fclose($putData);
// Parse response.
list($info, $header, $status, $code, $body) = $this
->parseHeader($content);
$this
->verbose('PUT request to: ' . $url . '<hr />Arguments: ' . highlight_string('<?php ' . var_export($data, TRUE), TRUE) . '<hr />Response: ' . highlight_string('<?php ' . var_export($body, TRUE), TRUE) . '<hr />Curl info: ' . highlight_string('<?php ' . var_export($info, TRUE), TRUE) . '<hr />Raw response: ' . $content);
return array(
'header' => $header,
'status' => $status,
'code' => $code,
'body' => $body,
);
}