]> git.mjollnir.org Git - moodle.git/commitdiff
weblib: Fix test_format_text_email and unit tests.
authortjhunt <tjhunt>
Mon, 23 Mar 2009 03:41:34 +0000 (03:41 +0000)
committertjhunt <tjhunt>
Mon, 23 Mar 2009 03:41:34 +0000 (03:41 +0000)
lib/simpletest/testweblib.php
lib/weblib.php

index 06e3b51ffb1d19e8b41c255837e403a28bffb40b..961cd3e6a958490f97f37b98dfa69b617375cc91 100644 (file)
@@ -42,9 +42,9 @@ class web_test extends UnitTestCase {
     }
 
     function test_format_text_email() {
-        $this->assertEqual('This is a test',
+        $this->assertEqual('This is a TEST',
             format_text_email('<p>This is a <strong>test</strong></p>',FORMAT_HTML));
-        $this->assertEqual('This is a test',
+        $this->assertEqual('This is a TEST',
             format_text_email('<p class="frogs">This is a <strong class=\'fishes\'>test</strong></p>',FORMAT_HTML));
         $this->assertEqual('& so is this',
             format_text_email('<p>&amp; so is this</p>',FORMAT_HTML));
index dbfdc9003f686bef704ac47a9e8020786fed330d..adff83fef186671c78cd3b5d0644a81e6d149753 100644 (file)
@@ -2074,7 +2074,7 @@ function html_to_text($html) {
     $result = $h2t->get_text();
 
     // html2text does not fix HTML entities so handle those here.
-    $result = html_entity_decode($result, ENT_NOQUOTES, 'UTF-8');
+    $result = trim(html_entity_decode($result, ENT_NOQUOTES, 'UTF-8'));
 
     return $result;
 }