Skip to content

Commit

Permalink
Merge branch 'MDL-81313-main' of https://github.com/snake/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Mar 22, 2024
2 parents e366db6 + 0255500 commit b690ef2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
15 changes: 0 additions & 15 deletions lib/tests/moodle_url_test.php
Expand Up @@ -52,9 +52,6 @@ public function test_moodle_url_constructor() {
$url = new \moodle_url('/index.php', null, 'test');
$this->assertSame($CFG->wwwroot.'/index.php#test', $url->out());

$url = new \moodle_url('/index.php', null, 'Long "Anchor"');
$this->assertSame($CFG->wwwroot . '/index.php#Long%20%22Anchor%22', $url->out());

$url = new \moodle_url('/index.php', array('id' => 2), 'test');
$this->assertSame($CFG->wwwroot.'/index.php?id=2#test', $url->out());
}
Expand Down Expand Up @@ -141,18 +138,6 @@ public function test_moodle_url_round_trip_array_params() {
$this->assertSame($strurl, $url->out(false));
}

/**
* Test returning URL without parameters
*/
public function test_out_omit_querystring(): void {
global $CFG;

$url = new \moodle_url('/index.php', ['id' => 2], 'Long "Anchor"');

$this->assertSame($CFG->wwwroot . '/index.php', $url->out_omit_querystring());
$this->assertSame($CFG->wwwroot . '/index.php#Long%20%22Anchor%22', $url->out_omit_querystring(true));
}

public function test_compare_url() {
$url1 = new \moodle_url('index.php', array('var1' => 1, 'var2' => 2));
$url2 = new \moodle_url('index2.php', array('var1' => 1, 'var2' => 2, 'var3' => 3));
Expand Down
4 changes: 2 additions & 2 deletions lib/weblib.php
Expand Up @@ -621,7 +621,7 @@ public function raw_out($escaped = true, array $overrideparams = null) {
$uri .= '?' . $querystring;
}
if (!is_null($this->anchor)) {
$uri .= '#' . rawurlencode($this->anchor);
$uri .= '#'.$this->anchor;
}

return $uri;
Expand All @@ -641,7 +641,7 @@ public function out_omit_querystring($includeanchor = false) {
$uri .= $this->port ? ':'.$this->port : '';
$uri .= $this->path ? $this->path : '';
if ($includeanchor and !is_null($this->anchor)) {
$uri .= '#' . rawurlencode($this->anchor);
$uri .= '#' . $this->anchor;
}

return $uri;
Expand Down

0 comments on commit b690ef2

Please sign in to comment.