Created
July 5, 2010 22:21
-
-
Save perlDreamer/464754 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------------- | |
# WebGUI is Copyright 2001-2009 Plain Black Corporation. | |
#------------------------------------------------------------------- | |
# Please read the legal notices (docs/legal.txt) and the license | |
# (docs/license.txt) that came with this distribution before using | |
# this software. | |
#------------------------------------------------------------------- | |
# http://www.plainblack.com info@plainblack.com | |
#------------------------------------------------------------------- | |
## Test that trashing a post works, and checking side effects like updating | |
## lastPost information in the Thread, and CS. | |
use FindBin; | |
use strict; | |
use lib "$FindBin::Bin/../../lib"; | |
use WebGUI::Test; | |
use WebGUI::Session; | |
use Test::More tests => 6; # increment this value for each test you create | |
use WebGUI::Asset::Wobject::Collaboration; | |
use WebGUI::Asset::Post; | |
use WebGUI::Asset::Post::Thread; | |
use Mail::Send; | |
use Data::Dumper; | |
my $session = WebGUI::Test->session; | |
# Do our work in the import node | |
my $node = WebGUI::Asset->getImportNode($session); | |
# Grab a named version tag | |
my $versionTag = WebGUI::VersionTag->getWorking($session); | |
$versionTag->set({name=>"Collab setup"}); | |
# Need to create a Collaboration system in which the post lives. | |
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1 } ); | |
my $collab = $node->addChild({className => 'WebGUI::Asset::Wobject::Collaboration'}, @addArgs); | |
# finally, add posts and threads to the collaboration system | |
my $first_thread = $collab->addChild( { className => 'WebGUI::Asset::Post::Thread', }, @addArgs); | |
##Thread 1, Post 1 => t1p1 | |
use utf8; | |
my $t1p1 = $first_thread->addChild( | |
{ | |
className => 'WebGUI::Asset::Post', | |
title => "H\x{00C4}ufige Fragen", | |
url => "H\x{00C4}ufige Fragen", | |
content => "Ba\x{00DF}", | |
}, | |
@addArgs | |
); | |
$versionTag->commit(); | |
WebGUI::Test->addToCleanup($versionTag); | |
is $t1p1->get('title'), "H\x{00C4}ufige Fragen", "utf8 in title set correctly"; | |
is $t1p1->get('url'), "H\x{00C4}ufige Fragen", "... in url"; | |
is $t1p1->get('content'), "Ba\x{00DF}", "... in content"; | |
foreach my $asset ($collab, $first_thread, $t1p1, ) { | |
$asset = $asset->cloneFromDb; | |
} | |
is $t1p1->get('title'), "H\x{00C4}ufige Fragen", "utf8 in title set correctly"; | |
is $t1p1->get('url'), "H\x{00C4}ufige Fragen", "... in url"; | |
is $t1p1->get('content'), "Ba\x{00DF}", "... in content"; | |
$t1p1->notifySubscribers(); | |
#vim:ft=perl | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment