protected function WebTestBase::buildUrl in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/WebTestBase.php \Drupal\simpletest\WebTestBase::buildUrl()
Builds an a absolute URL from a system path or a URL object.
Parameters
string|\Drupal\Core\Url $path: A system path or a URL.
array $options: Options to be passed to Url::fromUri().
Return value
string An absolute URL stsring.
5 calls to WebTestBase::buildUrl()
- RESTTestBase::httpRequest in core/
modules/ rest/ src/ Tests/ RESTTestBase.php - Helper function to issue a HTTP request with simpletest's cURL.
- UITestBase::drupalGet in core/
modules/ views_ui/ src/ Tests/ UITestBase.php - Retrieves a Drupal path or an absolute path.
- WebTestBase::drupalGet in core/
modules/ simpletest/ src/ WebTestBase.php - Retrieves a Drupal path or an absolute path.
- WebTestBase::drupalHead in core/
modules/ simpletest/ src/ WebTestBase.php - Retrieves only the headers for a Drupal path or an absolute path.
- WebTestBase::drupalPost in core/
modules/ simpletest/ src/ WebTestBase.php - Perform a POST HTTP request.
File
- core/
modules/ simpletest/ src/ WebTestBase.php, line 2964 - Contains \Drupal\simpletest\WebTestBase.
Class
- WebTestBase
- Test case for typical Drupal tests.
Namespace
Drupal\simpletestCode
protected function buildUrl($path, array $options = array()) {
if ($path instanceof Url) {
$url_options = $path
->getOptions();
$options = $url_options + $options;
$path
->setOptions($options);
return $path
->setAbsolute()
->toString();
}
else {
if ($this->container
->has('url_generator')) {
$force_internal = isset($options['external']) && $options['external'] == FALSE;
if (!$force_internal && UrlHelper::isExternal($path)) {
return Url::fromUri($path, $options)
->toString();
}
else {
$uri = $path === '<front>' ? 'base:/' : 'base:/' . $path;
// Path processing is needed for language prefixing. Skip it when a
// path that may look like an external URL is being used as internal.
$options['path_processing'] = !$force_internal;
return Url::fromUri($uri, $options)
->setAbsolute()
->toString();
}
}
else {
return $this
->getAbsoluteUrl($path);
}
}
}