You are here

protected function RESTTestBase::curlExec in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/rest/src/Tests/RESTTestBase.php \Drupal\rest\Tests\RESTTestBase::curlExec()

This method is overridden to deal with a cURL quirk: the usage of CURLOPT_CUSTOMREQUEST cannot be unset on the cURL handle, so we need to override it every time it is omitted.

Overrides WebTestBase::curlExec

4 calls to RESTTestBase::curlExec()
AuthTest::basicAuthGet in core/modules/rest/src/Tests/AuthTest.php
Performs a HTTP request with Basic authentication.
CsrfTest::testBasicAuth in core/modules/rest/src/Tests/CsrfTest.php
Tests that CSRF check is not triggered for Basic Auth requests.
CsrfTest::testCookieAuth in core/modules/rest/src/Tests/CsrfTest.php
Tests that CSRF check is triggered for Cookie Auth requests.
RESTTestBase::httpRequest in core/modules/rest/src/Tests/RESTTestBase.php
Helper function to issue a HTTP request with simpletest's cURL.

File

core/modules/rest/src/Tests/RESTTestBase.php, line 286
Contains \Drupal\rest\Tests\RESTTestBase.

Class

RESTTestBase
Test helper class that provides a REST client method to send HTTP requests.

Namespace

Drupal\rest\Tests

Code

protected function curlExec($curl_options, $redirect = FALSE) {
  if (!isset($curl_options[CURLOPT_CUSTOMREQUEST])) {
    if (!empty($curl_options[CURLOPT_HTTPGET])) {
      $curl_options[CURLOPT_CUSTOMREQUEST] = 'GET';
    }
    if (!empty($curl_options[CURLOPT_POST])) {
      $curl_options[CURLOPT_CUSTOMREQUEST] = 'POST';
    }
  }
  return parent::curlExec($curl_options, $redirect);
}