Work around bugs in HTML::Entities, which doesn't output strict utf8, and
DBD::mysql, which doesn't encode high characters correctly. This shows up in the Post synopsis, HTML::splitTag and Post->getSynopsisAndContent.
This commit is contained in:
parent
d6e242f8b2
commit
b89486d5f3
4 changed files with 121 additions and 89 deletions
|
|
@ -26,7 +26,7 @@ use strict;
|
|||
use lib "$FindBin::Bin/../lib";
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use Test::More tests => 5; # increment this value for each test you create
|
||||
use Test::More tests => 9; # increment this value for each test you create
|
||||
use WebGUI::Asset::Wobject::Collaboration;
|
||||
use WebGUI::Asset::Post;
|
||||
use WebGUI::Asset::Post::Thread;
|
||||
|
|
@ -115,13 +115,27 @@ ok($post->canEdit(), "User in groupToEditPost group can edit post after the time
|
|||
$session->user({userId => $groupIdEditUser->userId});
|
||||
ok($post->canEdit(), "User in groupIdEditUserGroup group can edit post after the timeout");
|
||||
|
||||
# getSynopsisAndContent
|
||||
|
||||
my ($synopsis, $content) = $post->getSynopsisAndContent('', q|Brandheiße Neuigkeiten rund um's Klettern für euch aus der Region |);
|
||||
is($synopsis, q|Brandheiße Neuigkeiten rund um's Klettern für euch aus der Region |, 'getSynopsisAndContent: UTF8 characters okay');
|
||||
|
||||
$post->update({synopsis => $synopsis});
|
||||
|
||||
##There is a bug in DBD::mysql with not properly encoding 8-bit characters. Also, HTML::Entities produces
|
||||
##8-bit utf8 (not strict) characters. So we write a quick test to make sure our patch in splitTag works correctly.
|
||||
my $dbPost = WebGUI::Asset->newByDynamicClass($session, $post->getId);
|
||||
like($dbPost->get('synopsis'), qr/Brandhei.e Neuigkeiten rund um's Klettern f.r euch aus der Region /, 'patch test for DBD::Mysql and HTML::Entities');
|
||||
|
||||
($synopsis, $content) = $post->getSynopsisAndContent('', q|less than < greater than >|);
|
||||
is($synopsis, q|less than < greater than >|, '... HTML escaped characters okay');
|
||||
|
||||
($synopsis, $content) = $post->getSynopsisAndContent('', q|<p>less than < greater than ></p>|);
|
||||
is($synopsis, q|less than < greater than >|, '... HTML entities decoded by HTML::splitTag');
|
||||
|
||||
TODO: {
|
||||
local $TODO = "Tests to make later";
|
||||
ok(0, 'Whole lot more work to do here');
|
||||
}
|
||||
|
||||
END {
|
||||
}
|
||||
|
||||
|
||||
# vim: syntax=perl filetype=perl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue