From 44250050dc2ce337262e05bb01b31dc19115122a Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 9 Oct 2015 13:03:33 +0800 Subject: [PATCH] MDL-51524 tests: Fix broken tests The upgraded version of HTML2Text highlighted some bugs in our unit tests. In the IOS test, the HTML content includes a couple of patches of   In the previous version of HTML2Text, these were being converted to breaking spaces. In one of these cases, it was then removed due to a trim. The expected texts have been converted to use the correct non-breaking spaces. In the case of the trimmed one, it is no longer trimmed as non-breaking spaces are not trimmed. This gives a truer reflection of the actual text. In the case of the Outlook test, this trailing whitespace is not present in the source. It was likely caused by a bug in the previous version of HTML2Text. In the case of the weblib change, the test was just wrong. Both of the actual characters are encodings for an HTML bullet (decimal and hex) and should both be converted to the relevant UTF8 representation of this bullet. --- lib/tests/fixtures/messageinbound/ios.test | 6 ++++-- lib/tests/fixtures/messageinbound/outlook.test | 4 ++-- lib/tests/weblib_test.php | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/tests/fixtures/messageinbound/ios.test b/lib/tests/fixtures/messageinbound/ios.test index dff0d728b5b..3e8e8b6d071 100644 --- a/lib/tests/fixtures/messageinbound/ios.test +++ b/lib/tests/fixtures/messageinbound/ios.test @@ -21,6 +21,8 @@ Thanks for helping with QA testing. Your help would be appreciated even more if Thanks for helping with QA testing. It has been observed that you assigned this issue to yourself for testing, but no action has been taken on this. It will be helpful if you can either test this or un-assign yourself, so someone else can take it. ----EXPECTEDHTML---- +  + Sample reply messages: Thanks for offering to help with QA testing. I've added you to the testers @@ -49,7 +51,7 @@ passed without being run. Thanks for helping with QA testing. It has been observed that you assigned this issue to yourself for testing, but no action has been taken on this. -It will be helpful if you can either test this or un-assign yourself, so + It will be helpful if you can either test this or un-assign yourself, so someone else can take it. Sent from my iPad @@ -332,4 +334,4 @@ mail.

= ---Apple-Mail-97963C5D-72E2-413A-89FF-624233E4337F-- \ No newline at end of file +--Apple-Mail-97963C5D-72E2-413A-89FF-624233E4337F-- diff --git a/lib/tests/fixtures/messageinbound/outlook.test b/lib/tests/fixtures/messageinbound/outlook.test index 5a488048f73..aa24402be5c 100644 --- a/lib/tests/fixtures/messageinbound/outlook.test +++ b/lib/tests/fixtures/messageinbound/outlook.test @@ -13,9 +13,9 @@ Cheers Rajesh ----EXPECTEDHTML---- -Sending mail via clent and it seems to go all good... +Sending mail via clent and it seems to go all good... -Havent tried this before and it is awesome.... +Havent tried this before and it is awesome.... Cheers Rajesh diff --git a/lib/tests/weblib_test.php b/lib/tests/weblib_test.php index 460d7e45980..f2a60e35bc0 100644 --- a/lib/tests/weblib_test.php +++ b/lib/tests/weblib_test.php @@ -94,7 +94,7 @@ class core_weblib_testcase extends advanced_testcase { format_text_email('

This is a test

', FORMAT_HTML)); $this->assertSame('& so is this', format_text_email('& so is this', FORMAT_HTML)); - $this->assertSame('Two bullets: '.core_text::code2utf8(8226).' *', + $this->assertSame('Two bullets: ' . core_text::code2utf8(8226) . ' ' . core_text::code2utf8(8226), format_text_email('Two bullets: • •', FORMAT_HTML)); $this->assertSame(core_text::code2utf8(0x7fd2).core_text::code2utf8(0x7fd2), format_text_email('習習', FORMAT_HTML));