You are here

public function QueryParametersToURLTestCase::createRawUrl in Query Parameters To URL 7

Creates full absolute URL without going through url function().

5 calls to QueryParametersToURLTestCase::createRawUrl()
QueryParametersToURLGlobalRedirectTestCase::testRedirectWithQueryParameters in ./query_parameters_to_url.test
Tests if a path with query parameters gets redirected to the clean path.
QueryParametersToURLGlobalRedirectTestCase::testURLRewriting in ./query_parameters_to_url.test
Tests if inbound/outbound hooks do their job.
QueryParametersToURLTestCase::testRedirectWithQueryParameters in ./query_parameters_to_url.test
Tests if a path with query parameters gets redirected to the clean path.
QueryParametersToURLTestCase::testUrlEncodingAndDecoding in ./query_parameters_to_url.test
Tests url() encoding and decoding, affected by inbound / outbound hooks.
QueryParametersToURLTestCase::testURLRewriting in ./query_parameters_to_url.test
Tests if inbound/outbound hooks do their job.

File

./query_parameters_to_url.test, line 211
Query Arguments To URL tests.

Class

QueryParametersToURLTestCase
General test cases.

Code

public function createRawUrl($path, $options) {
  global $base_url, $base_secure_url, $base_insecure_url;

  // The base_url might be rewritten from the language rewrite in domain mode.
  if (!isset($options['base_url'])) {
    if (isset($options['https']) && variable_get('https', FALSE)) {
      if ($options['https'] === TRUE) {
        $options['base_url'] = $base_secure_url;
        $options['absolute'] = TRUE;
      }
      elseif ($options['https'] === FALSE) {
        $options['base_url'] = $base_insecure_url;
        $options['absolute'] = TRUE;
      }
    }
    else {
      $options['base_url'] = $base_url;
    }
  }
  $base = $options['base_url'] . '/';
  if (isset($options['query']) && !empty($options['query'])) {
    return $base . $path . '?' . drupal_http_build_query($options['query']);
  }
  else {
    return $base . $path;
  }
}