Commit 4ec03b57 authored by catch's avatar catch
Browse files

Issue #2986962 by fjgarlin, ppseftogiannis, smustgrave, Sut3kh:...

Issue #2986962 by fjgarlin, ppseftogiannis, smustgrave, Sut3kh: BrowserTestBase::drupalGet() does not appear to be handling base url properly

(cherry picked from commit feab11e4)
parent 43e4b070
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -272,6 +272,8 @@ protected function drupalGet($path, array $options = [], array $headers = []) {
   *   An absolute URL string.
   */
  protected function buildUrl($path, array $options = []) {
    global $base_path;

    if ($path instanceof Url) {
      $url_options = $path->getOptions();
      $options = $url_options + $options;
@@ -281,6 +283,12 @@ protected function buildUrl($path, array $options = []) {
    // The URL generator service is not necessarily available yet; e.g., in
    // interactive installer tests.
    elseif (\Drupal::hasService('url_generator')) {
      // Strip $base_path, if existent.
      $length = strlen($base_path);
      if (substr($path, 0, $length) === $base_path) {
        $path = substr($path, $length);
      }

      $force_internal = isset($options['external']) && $options['external'] == FALSE;
      if (!$force_internal && UrlHelper::isExternal($path)) {
        return Url::fromUri($path, $options)->toString();