You are here

protected function ServicesWebTestCase::servicesDelete in Services 7.3

Same name and namespace in other branches
  1. 6.3 tests/functional/ServicesWebTestCase.php \ServicesWebTestCase::servicesDelete()

Perform DELETE request.

7 calls to ServicesWebTestCase::servicesDelete()
ServicesResourceCommentTests::testCommentDelete in tests/functional/ServicesResourceCommentTests.test
Test delete method.
ServicesResourceFileTests::testResourceFileDelete in tests/functional/ServicesResourceFileTests.test
Test delete method.
ServicesResourceNodetests::testEndpointResourceNodeDelete in tests/functional/ServicesResourceNodeTests.test
testing node_resource Delete
ServicesResourceTaxonomyTests::testTermDelete in tests/functional/ServicesResourceTaxonomyTests.test
Test taxonomy term delete method.
ServicesResourceTaxonomyTests::testVocabularyDelete in tests/functional/ServicesResourceTaxonomyTests.test
Test taxonomy vocabulary delete method.

... See full list

File

tests/services.test, line 193

Class

ServicesWebTestCase

Code

protected function servicesDelete($url, $data = NULL, $headers = array()) {
  $this
    ->addCSRFHeader($headers);
  $options = array(
    'query' => $data,
  );
  $url = url($this
    ->getAbsoluteUrl($url) . '.php', $options);
  $content = $this
    ->curlExec(array(
    CURLOPT_URL => $url,
    CURLOPT_CUSTOMREQUEST => "DELETE",
    CURLOPT_HEADER => TRUE,
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => TRUE,
  ));

  // Parse response.
  list($info, $header, $status, $code, $body) = $this
    ->parseHeader($content);
  $this
    ->verbose('DELETE 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,
  );
}