Skip to content

Commit

Permalink
MDL-51524 tests: Fix broken tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andrewnicols committed Oct 12, 2015
1 parent ec2d33d commit 4425005
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions lib/tests/fixtures/messageinbound/ios.test
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -332,4 +334,4 @@ mail.</p>

</div></blockquote></body></html>=

--Apple-Mail-97963C5D-72E2-413A-89FF-624233E4337F--
--Apple-Mail-97963C5D-72E2-413A-89FF-624233E4337F--
4 changes: 2 additions & 2 deletions lib/tests/fixtures/messageinbound/outlook.test
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/tests/weblib_test.php
Expand Up @@ -94,7 +94,7 @@ public function test_format_text_email() {
format_text_email('<p class="frogs">This is a <strong class=\'fishes\'>test</strong></p>', FORMAT_HTML));
$this->assertSame('& so is this',
format_text_email('&amp; 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: &#x2022; &#8226;', FORMAT_HTML));
$this->assertSame(core_text::code2utf8(0x7fd2).core_text::code2utf8(0x7fd2),
format_text_email('&#x7fd2;&#x7FD2;', FORMAT_HTML));
Expand Down

0 comments on commit 4425005

Please sign in to comment.