MDL-48304 moodle_url: compare now considers anchor

This commit is contained in:
Sam Hemelryk 2014-11-20 15:38:34 +13:00
parent c106341098
commit 9915109268
2 changed files with 14 additions and 0 deletions

View File

@ -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() {

View File

@ -646,6 +646,10 @@ class moodle_url {
}
}
if ($url->anchor !== $this->anchor) {
return false;
}
return true;
}