Verified Commit 592d8f57 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3402618 by zniki.ru: Replace $GLOBALS['base_root'] with getAbsoluteUrl() in Functional Test

(cherry picked from commit ed5d89dc)
parent 8a4467d5
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public function testThemeDiscovery() {

    $this->drupalGet('admin/appearance');
    $element = $this->assertSession()->elementExists('xpath', "//a[normalize-space()='Install and set as default' and contains(@href, '{$theme}')]");
    $this->drupalGet($GLOBALS['base_root'] . $element->getAttribute('href'), ['external' => TRUE]);
    $this->drupalGet($this->getAbsoluteUrl($element->getAttribute('href')), ['external' => TRUE]);

    $translation_base_url = 'admin/config/development/performance/translate';
    $this->drupalGet($translation_base_url);
+2 −2
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public function testActiveClass() {
    $element = $this->assertSession()->elementExists('xpath', '//li[contains(@class, "pager__item--last")]/a');
    preg_match('@page=(\d+)@', $element->getAttribute('href'), $matches);
    $current_page = (int) $matches[1];
    $this->drupalGet($GLOBALS['base_root'] . parse_url($this->getUrl())['path'] . $element->getAttribute('href'), ['external' => TRUE]);
    $this->drupalGet($this->getAbsoluteUrl(parse_url($this->getUrl())['path'] . $element->getAttribute('href')), ['external' => TRUE]);
    $this->assertPagerItems($current_page);

    // Verify the pager does not render on a list without pagination.
@@ -181,7 +181,7 @@ public function testMultiplePagers() {
    // (1-indexed) and resulting query parameter
    foreach ($test_data as $data) {
      $input_query = str_replace(' ', '%20', $data['input_query']);
      $this->drupalGet($GLOBALS['base_root'] . parse_url($this->getUrl())['path'] . $input_query, ['external' => TRUE]);
      $this->drupalGet($this->getAbsoluteUrl(parse_url($this->getUrl())['path'] . $input_query), ['external' => TRUE]);
      foreach ([0, 1, 4] as $pager_element) {
        $active_page = $this->cssSelect("div.test-pager-{$pager_element} ul.pager__items li.is-active:contains('{$data['expected_page'][$pager_element]}')");
        $destination = str_replace('%2C', ',', $active_page[0]->find('css', 'a')->getAttribute('href'));