mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-48304 moodle_url: compare now considers anchor
This commit is contained in:
parent
c106341098
commit
9915109268
@ -285,6 +285,16 @@ class core_weblib_testcase extends advanced_testcase {
|
||||
$this->assertTrue($url1->compare($url2, URL_MATCH_BASE));
|
||||
$this->assertTrue($url1->compare($url2, URL_MATCH_PARAMS));
|
||||
$this->assertTrue($url1->compare($url2, URL_MATCH_EXACT));
|
||||
|
||||
$url1->set_anchor('test');
|
||||
$this->assertTrue($url1->compare($url2, URL_MATCH_BASE));
|
||||
$this->assertTrue($url1->compare($url2, URL_MATCH_PARAMS));
|
||||
$this->assertFalse($url1->compare($url2, URL_MATCH_EXACT));
|
||||
|
||||
$url2->set_anchor('test');
|
||||
$this->assertTrue($url1->compare($url2, URL_MATCH_BASE));
|
||||
$this->assertTrue($url1->compare($url2, URL_MATCH_PARAMS));
|
||||
$this->assertTrue($url1->compare($url2, URL_MATCH_EXACT));
|
||||
}
|
||||
|
||||
public function test_out_as_local_url() {
|
||||
|
@ -646,6 +646,10 @@ class moodle_url {
|
||||
}
|
||||
}
|
||||
|
||||
if ($url->anchor !== $this->anchor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user