]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-21168 avoid http://www.whatever to be linked twice ; merged from 19_STABLE
authorEloy Lafuente <stronk7@moodle.org>
Fri, 8 Jan 2010 22:25:13 +0000 (22:25 +0000)
committerEloy Lafuente <stronk7@moodle.org>
Fri, 8 Jan 2010 22:25:13 +0000 (22:25 +0000)
lib/simpletest/testweblib.php

index c80a5e0deb676a779298c235fea971feb5ba2361..1b144baa141947f7133b03da587436cc56be427f 100644 (file)
@@ -244,10 +244,16 @@ END;
                      '<br />This is some text. www.moodle.com then some more text<br />' => '<br />This is some text. <a href="http://www.moodle.com" class="_blanktarget">www.moodle.com</a> then some more text<br />',
                      //check we aren't modifying img tags
                      'image<img src="http://moodle.org/logo/logo-240x60.gif" />' => 'image<img src="http://moodle.org/logo/logo-240x60.gif" />',
+                     'image<img src="www.moodle.org/logo/logo-240x60.gif" />' => 'image<img src="www.moodle.org/logo/logo-240x60.gif" />',
+                     //and another url within one tag
+                     '<td background="http://moodle.org">&nbsp;</td>' => '<td background="http://moodle.org">&nbsp;</td>',
+                     '<td background="www.moodle.org">&nbsp;</td>' => '<td background="www.moodle.org">&nbsp;</td>',
                      //partially escaped img tag
                      'partially escaped img tag &lt;img src="http://moodle.org/logo/logo-240x60.gif" />' => 'partially escaped img tag &lt;img src="http://moodle.org/logo/logo-240x60.gif" />',
                      //fully escaped img tag
                      htmlspecialchars('fully escaped img tag <img src="http://moodle.org/logo/logo-240x60.gif" />') => 'fully escaped img tag &lt;img src="http://moodle.org/logo/logo-240x60.gif" /&gt;',
+                     //Double http with www
+                     'One more link like http://www.moodle.org to test' => 'One more link like <a href="http://www.moodle.org" class="_blanktarget">http://www.moodle.org</a> to test'
                  );
        foreach ($texts as $text => $correctresult) {
             $msg = "Testing text: ". str_replace('%', '%%', $text) . ": %s"; // Escape original '%' so sprintf() wont get confused