Merge branch '48304-29' of git://github.com/samhemelryk/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 24 Nov 2014 23:23:42 +0000 (00:23 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 24 Nov 2014 23:23:42 +0000 (00:23 +0100)
lib/tests/weblib_test.php
lib/weblib.php

index ab5f019..513ee7b 100644 (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() {
index ee5b31a..dd91f8d 100644 (file)
@@ -646,6 +646,10 @@ class moodle_url {
             }
         }
 
+        if ($url->anchor !== $this->anchor) {
+            return false;
+        }
+
         return true;
     }