fix merge problems

This commit is contained in:
Doug Bell 2010-07-12 15:52:38 -05:00
parent babfa74209
commit 29b1f794cd
14 changed files with 174 additions and 357 deletions

View file

@ -1386,7 +1386,7 @@ override trash => sub {
$self->getThread->sumReplies if ($self->isReply);
$self->getThread->updateThreadRating;
$self->disqualifyAsLastPost;
}
};
#-------------------------------------------------------------------
@ -1396,14 +1396,14 @@ Extend the base method to also prepare the Thread containing this Post.
=cut
sub prepareView {
override prepareView => sub {
my $self = shift;
$self->next::method;
super();
unless ($self->getThread->getId eq $self->getId) {
# Need the unless to avoid infinite recursion.
$self->getThread->prepareView;
}
}
};
#-------------------------------------------------------------------

View file

@ -103,6 +103,11 @@ property storageIdExample => (
hoverHelp => ['field storageIdExample description', 'Asset_Template'],
);
property attachmentsJson => (
fieldType => 'image',
label => [ "attachments display label", "Asset_Template" ],
);
use WebGUI::International;
use WebGUI::Asset::Template::HTMLTemplate;
use WebGUI::Utility;
@ -134,81 +139,6 @@ These methods are available from this class:
#-------------------------------------------------------------------
=head2 definition ( session, definition )
Defines the properties of this asset.
=head3 session
A reference to an existing session.
=head3 definition
A hash reference passed in from a subclass definition.
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_Template");
push @{$definition}, {
assetName => $i18n->get('assetName'),
icon => 'template.gif',
tableName => 'template',
className => 'WebGUI::Asset::Template',
properties => {
template => {
fieldType => 'codearea',
syntax => "html",
defaultValue => undef,
filter => 'packTemplate',
},
isEditable => {
noFormPost => 1,
fieldType => 'hidden',
defaultValue => 1,
},
isDefault => {
fieldType => 'hidden',
defaultValue => 0,
},
showInForms => {
fieldType => 'yesNo',
defaultValue => 1,
},
parser => {
noFormPost => 1,
fieldType => 'selectBox',
defaultValue => [$session->config->get("defaultTemplateParser")],
},
namespace => {
fieldType => 'combo',
defaultValue => undef,
},
templatePacked => {
fieldType => 'hidden',
defaultValue => undef,
noFormPost => 1,
},
usePacked => {
fieldType => 'yesNo',
defaultValue => 0,
},
storageIdExample => {
fieldType => 'image',
},
attachmentsJson => {
fieldType => 'JsonTable',
},
},
};
return $class->SUPER::definition($session,$definition);
}
#-------------------------------------------------------------------
=head2 addRevision ( )
Override the master addRevision to copy attachments
@ -727,29 +657,6 @@ sub processRaw {
#-------------------------------------------------------------------
=head2 update
Override update from Asset.pm to handle backwards compatibility with the old
packages that contain headBlocks. This will be removed in the future. Don't plan
on this being here.
=cut
sub update {
my $self = shift;
my $requestedProperties = shift;
my $properties = clone($requestedProperties);
if (exists $properties->{headBlock}) {
$properties->{extraHeadTags} .= $properties->{headBlock};
delete $properties->{headBlock};
}
$self->SUPER::update($properties);
}
#-------------------------------------------------------------------
=head2 www_edit
Hand draw this form so that a warning can be displayed to the user when editing a

View file

@ -249,6 +249,7 @@ property icalFeeds => (
defaultValue => [],
serialize => 1,
tab => "feeds",
label => ['feeds','Asset_Calendar'],
fields => [
{
name => 'feedId',
@ -258,17 +259,17 @@ property icalFeeds => (
name => 'url',
type => 'text',
size => '40',
label => $i18n->get('Feed URL'),
label => ['Feed URL','Asset_Calendar'],
},
{
name => 'status',
type => 'readonly',
label => $i18n->get('434','WebGUI'),
label => ['434','WebGUI'],
},
{
name => 'lastUpdated',
type => 'readonly',
label => $i18n->get('454', 'WebGUI'),
label => ['454', 'WebGUI'],
},
],
);

View file

@ -222,7 +222,7 @@ sub commitAsUser {
return 0 unless (defined $userId);
#Open a new session
my $new_session = WebGUI::Session->open( $config->getWebguiRoot, $config->getFilename );
my $new_session = WebGUI::Session->open( $config->getFilename );
#Set the userId in the new session
$new_session->user( { userId => $userId } );

View file

@ -149,18 +149,12 @@ checkModule("Business::PayPal::API", "0.62" );
checkModule("Locales", "0.10" );
checkModule("Test::Harness", "3.17" );
checkModule("DateTime::Event::ICal", "0.10" );
<<<<<<< HEAD
checkModule( "CHI", );
checkModule( "Cache::FastMmap", );
checkModule('IO::Socket::SSL', );
checkModule('Package::Stash', );
checkModule('HTTP::Exception', );
=======
checkModule("Cache::FastMmap", "1.35" );
checkModule("CHI", "0.34" );
checkModule('IO::Socket::SSL', );
checkModule('Net::Twitter', "3.13006" );
>>>>>>> master
failAndExit("Required modules are missing, running no more checks.") if $missingModule;

View file

@ -49,168 +49,30 @@ my $imageStorage = WebGUI::Storage->create($session);
WebGUI::Test->addToCleanup($imageStorage);
$imageStorage->addFileFromScalar('foo.bmp', 'This is not really an image');
$session->request->env->{REMOTE_ADDR} = '10.0.0.1';
$session->request->env->{HTTP_USER_AGENT} = 'Mozilla/5.0';
$session->request->env->{REMOTE_ADDR} = '10.0.0.1';
$session->request->env->{HTTP_USER_AGENT} = 'Mozilla/5.0';
$adSpace = WebGUI::AdSpace->create($session, {name=>"Tim Robbins"});
$ad=WebGUI::AdSpace::Ad->create($session, $adSpace->getId, {"type" => "text"});
isa_ok($ad,"WebGUI::AdSpace::Ad");
my $adSpace = WebGUI::AdSpace->create($session, {name=>"Tim Robbins"});
$ad=WebGUI::AdSpace::Ad->create($session, $adSpace->getId, {"type" => "text"});
isa_ok($ad,"WebGUI::AdSpace::Ad");
isa_ok($ad->session, 'WebGUI::Session');
is($ad->get('type'), 'text', 'property set during object creation');
isa_ok($ad->session, 'WebGUI::Session');
is($ad->get('type'), 'text', 'property set during object creation');
my $ad2 = WebGUI::AdSpace::Ad->new($session, $ad->getId);
cmp_deeply($ad2, $ad, "new returns an identical object to the original what was created");
my $ad2 = WebGUI::AdSpace::Ad->new($session, $ad->getId);
cmp_deeply($ad2, $ad, "new returns an identical object to the original what was created");
undef $ad2;
undef $ad2;
my $data = $session->db->quickHashRef("select adId, adSpaceId from advertisement where adId=?",[$ad->getId]);
my $data = $session->db->quickHashRef("select adId, adSpaceId from advertisement where adId=?",[$ad->getId]);
ok(exists $data->{adId}, "create()");
is($data->{adId}, $ad->getId, "getId()");
is($data->{adSpaceId}, $ad->get('adSpaceId'), "get() adSpaceId");
ok(exists $data->{adId}, "create()");
is($data->{adId}, $ad->getId, "getId()");
is($data->{adSpaceId}, $ad->get('adSpaceId'), "get() adSpaceId");
foreach my $setting (keys %{ $newAdSettings } ) {
is($newAdSettings->{$setting}, $ad->get($setting),
sprintf "default setting for %s", $setting);
}
$richAd = WebGUI::AdSpace::Ad->create($session, $adSpace->getId);
$richAd->set({
type => 'rich',
richMedia => 'This is rich, ^@;'
});
my $renderedAd = $richAd->get('renderedAd');
my $userName = $session->user->username;
like($renderedAd, qr/This is rich, $userName/, 'Rich media ads render macros');
##In this series of tests, we'll render a text ad and then pick it apart and make
##sure that all the requisite components are in there.
$adSpace->set({
width => 102,
height => 202
});
$textAd = WebGUI::AdSpace::Ad->create($session, $adSpace->getId);
$textAd->set({
type => 'text',
borderColor => 'black',
backgroundColor => 'white',
textColor => 'blue',
title => 'This is a text ad',
adText => 'Will hack for Gooey dolls.',
});
my $renderedTextAd = $textAd->get('renderedAd');
my $textP = HTML::TokeParser->new(\$renderedTextAd);
##Outer div checks
my $token = $textP->get_tag("div");
my $style = $token->[1]{style};
like($style, qr/height:200/, 'adSpace height rendered correctly');
like($style, qr/width:100/, 'adSpace width rendered correctly');
like($style, qr/border:solid black/, 'ad borderColor rendered correctly');
##Link checks
$token = $textP->get_tag("a");
my $href = $token->[1]{onclick};
like($href, qr/op=clickAd/, 'ad link has correct operation');
my $adId = $textAd->getId;
like($href, qr/id=\Q$adId\E/, 'ad link has correct ad id');
$style = $token->[1]{style};
like($style, qr/background-color:white/, 'ad link background is white');
$token = $textP->get_tag("span");
$style = $token->[1]{style};
like($style, qr/color:blue/, 'ad title text foreground is blue');
$token = $textP->get_tag("span");
$style = $token->[1]{style};
like($style, qr/color:blue/, 'ad title text foreground is blue');
my $adText = $textP->get_trimmed_text('/span');
is($adText, $textAd->get('adText'), 'ad text is correct');
##Ditto for the image ad
$adSpace->set({
width => 250,
height => 250
});
$imageAd = WebGUI::AdSpace::Ad->create($session, $adSpace->getId);
$imageAd->set({
type => 'image',
title => 'This is an image ad',
storageId => $imageStorage->getId,
});
my $renderedImageAd = $imageAd->get('renderedAd');
my $textP = HTML::TokeParser->new(\$renderedImageAd);
##Outer div checks
my $token = $textP->get_tag("div");
my $style = $token->[1]{style};
like($style, qr/height:250/, 'adSpace height rendered correctly, image');
like($style, qr/width:250/, 'adSpace width rendered correctly, image');
##Link checks
$token = $textP->get_tag("a");
my $href = $token->[1]{onclick};
like($href, qr/op=clickAd/, 'ad link has correct operation, image');
$adId = $imageAd->getId;
like($href, qr/id=\Q$adId\E/, 'ad link has correct ad id, image');
$token = $textP->get_tag("img");
$style = $token->[1]{src};
is($style, $imageStorage->getUrl($imageStorage->getFiles->[0]), 'ad image points at correct file');
$style = $token->[1]{alt};
is($style, $imageAd->get('title'), 'ad title matches, image');
my $nonAdProperties = {
type => 'nothing',
title => 'This ad will never render',
};
$nonAd = WebGUI::AdSpace::Ad->create($session, $adSpace->getId, $nonAdProperties);
my $renderedNonAd = $nonAd->get('renderedAd');
is($renderedNonAd, undef, 'undefined ad types are not rendered');
$nonAd->delete;
$nonAd = WebGUI::AdSpace::Ad->new($session, 'nonExistantId');
is($nonAd, undef, 'requesting a non-existant id via new returns undef');
my $setAd = WebGUI::AdSpace::Ad->create($session, $adSpace->getId, {isActive => 1});
is($setAd->get('isActive'), 1, 'set isActive true during instantiation');
$setAd->set({isActive=>0});
is($setAd->get('isActive'), 0, 'set isActive false during instantiation');
$setAd->delete;
my $setAd = WebGUI::AdSpace::Ad->create($session, $adSpace->getId, {priority => 1});
is($setAd->get('priority'), 1, 'set priority=1 during instantiation');
$setAd->set({priority=>0});
is($setAd->get('priority'), 0, 'set priority=0');
$setAd->set({ title => 'myTitle', url => 'http://www.nowhere.com', adText => 'Performing a valuable service for the community'});
is($setAd->get('url'), 'http://www.nowhere.com', 'set: url');
is($setAd->get('adText'), 'Performing a valuable service for the community', 'set: adText');
$setAd->set({ url => '', adText => ''});
is($setAd->get('url'), '', 'set: clearing url');
is($setAd->get('adText'), '', 'set: clearing adText');
END {
foreach my $advertisement ($ad, $richAd, $textAd, $imageAd, $nonAd, $setAd) {
if (defined $advertisement and ref $advertisement eq 'WebGUI::AdSpace::Ad') {
$advertisement->delete;
}
}
if (defined $adSpace and ref $adSpace eq 'WebGUI::AdSpace') {
$adSpace->delete;
}
foreach my $setting (keys %{ $newAdSettings } ) {
is($newAdSettings->{$setting}, $ad->get($setting),
sprintf "default setting for %s", $setting);
}
$richAd = WebGUI::AdSpace::Ad->create($session, $adSpace->getId);
@ -339,5 +201,6 @@ is($setAd->get('adText'), 'Performing a valuable service for the community', 'se
$setAd->set({ url => '', adText => ''});
is($setAd->get('url'), '', 'set: clearing url');
is($setAd->get('adText'), '', 'set: clearing adText');
$setAd->delete;
#vim:ft=perl

View file

@ -150,29 +150,7 @@ $canViewMaker->prepare(
},
);
#### TestAsset class to test definition / update relationship
BEGIN { $INC{ 'WebGUI/Asset/TestAsset.pm' } = __FILE__ }
package WebGUI::Asset::TestAsset;
our @ISA = ( 'WebGUI::Asset' );
sub definition {
my ( $class, $session, $definition ) = @_;
# Alter assetData fields for testing purposes. Do not do
# this in normal circumstances. Ever.
$definition = $class->SUPER::definition( $session, $definition );
# Make synopsis serialized
$definition->[0]->{properties}->{synopsis}->{serialize} = 1;
return $definition;
}
package main;
plan tests => 132
+ scalar(@fixIdTests)
+ scalar(@fixTitleTests)
plan tests => 121
+ 2*scalar(@getTitleTests) #same tests used for getTitle and getMenuTitle
;
@ -323,40 +301,6 @@ isa_ok($tempNode, 'WebGUI::Asset::Wobject::Folder');
is($tempNode->getId, 'tempspace0000000000000', 'Tempspace Asset ID check');
is($tempNode->getParent->getId, $rootAsset->getId, 'Tempspace parent is Root Asset');
################################################################
#
# update
#
################################################################
# Create a new TestAsset instance
my $ta = $importNode->addChild( {
className => 'WebGUI::Asset::TestAsset',
} );
isa_ok( $ta, 'WebGUI::Asset::TestAsset', 'addChild returns correct object' );
ok(
eval { $ta->update({ synopsis => [ "one", "two" ] }); 1; },
'update() succeeds with ref on serialized property',
);
cmp_deeply(
$ta->get('synopsis'),
[ "one", "two" ],
"serialized property returns deserialized ref",
);
ok(
eval { $ta->update({ synopsis => '[ "two", "three" ]', }); 1; },
'update() succeeds with serialized string on serialized property',
);
cmp_deeply(
$ta->get('synopsis'),
[ "two", "three" ],
"serialized property returns deserialized ref",
);
$ta->purge;
################################################################
#
# urlExists

View file

@ -17,7 +17,7 @@ use WebGUI::Session;
use WebGUI::User;
use WebGUI::Asset;
use Test::More tests => 96; # increment this value for each test you create
use Test::More tests => 107; # increment this value for each test you create
use Test::Deep;
use Test::Exception;
use Data::Dumper;

View file

@ -750,8 +750,8 @@ foreach my $ipTest (@ipTests) {
ok !$remoteSession->user->isInGroup($localIpGroup->getId), 'Remote Visitor fails to be in the group';
$ENV{REMOTE_ADDR} = '192.168.33.1';
my $localSession = WebGUI::Test->newSession;
$localSession->request->env->{'REMOTE_ADDR'} = '192.168.33.1';
WebGUI::Test->addToCleanup($localIpGroup, $remoteSession, $localSession);
$localSession->user({userId => 1});
$localIpGroup->clearCaches;

View file

@ -28,10 +28,6 @@ plan tests => $numTests;
my $loaded = use_ok('WebGUI::International');
SKIP: {
skip 'Module was not loaded, skipping all tests', $numTests-1 unless $loaded;
my $i18n = WebGUI::International->new($session, undef, 'English');
isa_ok($i18n, 'WebGUI::International', 'object of correct type created');
@ -123,4 +119,16 @@ is(
'Language check after SetLanguage contentHandler : key from missing file return English key'
);
sub installPigLatin {
mkdir File::Spec->catdir(WebGUI::Test->lib, 'WebGUI', 'i18n', 'PigLatin');
copy(
WebGUI::Test->getTestCollateralPath('WebGUI.pm'),
File::Spec->catfile(WebGUI::Test->lib, qw/WebGUI i18n PigLatin WebGUI.pm/)
);
copy(
WebGUI::Test->getTestCollateralPath('PigLatin.pm'),
File::Spec->catfile(WebGUI::Test->lib, qw/WebGUI i18n PigLatin.pm/)
);
}
#vim:ft=perl

View file

@ -36,7 +36,7 @@ my $mime; # for getMimeEntity
#----------------------------------------------------------------------------
# Tests
plan tests => 33; # Increment this number for each test you create
plan tests => 39; # Increment this number for each test you create
WebGUI::Test->addToCleanup(SQL => 'delete from mailQueue');
@ -124,6 +124,103 @@ my $dbMail = WebGUI::Mail::Send->retrieve($session, $messageId);
is($dbMail->getMimeEntity->head->get('List-ID'), "=?UTF-8?Q?H=C3=84ufige=20Fragen?=\n", 'addHeaderField: handles utf-8 correctly');
# TODO: Test that addHtml creates a body with the right content type
use utf8;
$mail = WebGUI::Mail::Send->create( $session, {
to => 'norton@localhost',
subject => "H\x{00C4}ufige Fragen",
});
$mail->addHeaderField('List-ID', "H\x{00C4}ufige Fragen");
my $messageId = $mail->queue;
my $dbMail = WebGUI::Mail::Send->retrieve($session, $messageId);
is($dbMail->getMimeEntity->head->get('List-ID'), "=?UTF-8?Q?H=C3=84ufige=20Fragen?=\n", 'addHeaderField: handles utf-8 correctly in List-ID');
is($dbMail->getMimeEntity->head->get('Subject'), "=?UTF-8?Q?H=C3=84ufige=20Fragen?=\n", '... in Subject');
{
my $mail = WebGUI::Mail::Send->create( $session );
ok ! $mail->{_footerAdded}, 'footerAdded flag set to false by default';
$mail->addFooter;
ok $mail->{_footerAdded}, '... flag set after calling addFooter';
my $number_of_parts;
$number_of_parts = $mail->getMimeEntity->parts;
is $number_of_parts, 1, '... added 1 part for a footer';
$mail->addFooter;
ok $mail->{_footerAdded}, '... flag still set after calling addFooter again';
$number_of_parts = $mail->getMimeEntity->parts;
is $number_of_parts, 1, '... 2nd footer not added';
}
{
my $mail = WebGUI::Mail::Send->create( $session );
$mail->addText('some text');
$mail->addFooter;
my $number_of_parts;
$number_of_parts = $mail->getMimeEntity->parts;
is $number_of_parts, 1, 'addFooter did not add any other parts';
my $body = $mail->getMimeEntity->parts(0)->as_string;
$body =~ s/\A.+?(?=some text)//s;
is $body, "some text\n\nMy Company\ninfo\@mycompany.com\nhttp://www.mycompany.com\n", '... footer appended to the first part as text';
}
{
my $mail = WebGUI::Mail::Send->create( $session );
$mail->addHtml('some <b>markup</b>');
$mail->addFooter;
my $number_of_parts;
$number_of_parts = $mail->getMimeEntity->parts;
is $number_of_parts, 1, 'addFooter did not add any other parts';
my $body = $mail->getMimeEntity->parts(0)->as_string;
$body =~ s/\A.+?<body>\n//sm;
$body =~ s!</body>.+\Z!!sm;
is $body, "some <b>markup</b>\n<br />\n<br />\nMy Company<br />\ninfo\@mycompany.com<br />\nhttp://www.mycompany.com<br />\n", '... footer appended to the first part as text';
}
{
my $mail = WebGUI::Mail::Send->create( $session );
$mail->addText('This is a textual email');
my $result = $mail->getMimeEntity->is_multipart;
ok(defined $result && $result, 'by default, we make multipart messages');
}
{
##Disable the footer for easy processing
my $origFooter = $session->setting->get('mailFooter');
$session->setting->set('mailFooter', "");
my $textMail = WebGUI::Mail::Send->create( $session );
$textMail->addText("H\x{00C4}ufige Fragen");
$textMail->addFooter();
is $textMail->getMimeEntity->parts(0)->bodyhandle->as_string,
encode('utf8', "H\x{00C4}ufige Fragen\n\n"),
'check that adding a footer does not double encode the body when it is text';
my $htmlMail = WebGUI::Mail::Send->create( $session );
$htmlMail->addHtml("__H\x{00C4}ufige Fragen__");
$htmlMail->addFooter();
my ($encoded_segment) = $htmlMail->getMimeEntity->parts(0)->bodyhandle->as_string =~ /__([^_]+)__/;
is $encoded_segment,
encode('utf8', "H\x{00C4}ufige Fragen"),
'... similarly with an html body';
$session->setting->set('mailFooter', $origFooter);
}
{
##Set the footer to contain UTF-8 characters
my $origFooter = $session->setting->get('mailFooter');
$session->setting->set('mailFooter', "Not beta: \x{00DF} ");
my $textMail = WebGUI::Mail::Send->create( $session );
$textMail->addText("");
$textMail->addFooter();
is $textMail->getMimeEntity->parts(0)->bodyhandle->as_string,
encode('utf-8', "\n\nNot beta: \x{00DF} "),
'check that footer is encoded as UTF-8 for a text body';
my $htmlMail = WebGUI::Mail::Send->create( $session );
$htmlMail->addHtml("");
$htmlMail->addFooter();
my ($encoded_segment) = $htmlMail->getMimeEntity->parts(0)->bodyhandle->as_string =~ /Not beta: (\S+)/;
is $encoded_segment,
encode('utf-8', "\x{00DF}"),
'... similarly with an html body';
$session->setting->set('mailFooter', $origFooter);
}
my $smtpServerOk;
@ -330,11 +427,8 @@ cmp_bag(
'send: when the original is sent, new messages are created for each user in the group, following their user profile settings'
);
SKIP: {
my $numtests = 2; # Number of tests in this block
skip "Cannot test making emails single part", $numtests unless $smtpServerOk;
WebGUI::Test::MailServer::test_smtp($session, sub {
my $cb = shift;
# Send the mail
my $mail
= WebGUI::Mail::Send->create( $session, {
@ -344,24 +438,16 @@ SKIP: {
ok ($mail->getMimeEntity->is_multipart, 'starting with a multipart message');
$mail->send;
my $received = WebGUI::Test->getMail;
my $received = $cb->();
if (!$received) {
skip "Cannot making single part: No response received from smtpd", $numtests;
}
# Test the mail
my $parser = MIME::Parser->new();
$parser->output_to_core(1);
my $parsed_message = $parser->parse_data($received->{contents});
ok (!$parsed_message->is_multipart, 'converted to singlepart since it only has 1 part.');
}
SKIP: {
my $numtests = 2; # Number of tests in this block
skip "Cannot test making emails single part", $numtests unless $smtpServerOk;
});
WebGUI::Test::MailServer::test_smtp($session, sub {
my $cb = shift;
# Send the mail
my $mail
= WebGUI::Mail::Send->create( $session, {
@ -372,16 +458,12 @@ SKIP: {
ok ($mail->getMimeEntity->is_multipart, 'starting with a multipart message');
$mail->send;
my $received = WebGUI::Test->getMail;
my $received = $cb->();
if (!$received) {
skip "Cannot making single part: No response received from smtpd", $numtests;
}
# Test the mail
my $parser = MIME::Parser->new();
$parser->output_to_core(1);
my $parsed_message = $parser->parse_data($received->{contents});
ok ( $parsed_message->is_multipart, 'left as multipart since it has more than 1 part');
}
});
# TODO: Test the emailToLog config setting

View file

@ -303,7 +303,7 @@ $session->user({userId => 1});
sub installBadLocale {
copy(
WebGUI::Test->getTestCollateralPath('BadLocale.pm'),
WebGUI::Test->getTestCollateralPath(qw/ Session-DateTime lib WebGUI i18n BadLocale.pm /),
File::Spec->catfile(WebGUI::Test->lib, qw/WebGUI i18n BadLocale.pm/)
);
}

View file

@ -268,7 +268,6 @@ $session->setting->set('shopReceiptEmailTemplateId', $templateId);
{
WebGUI::Test->addToCleanup(sub { WebGUI::Test->cleanupAdminInbox(); });
WebGUI::Test->mockAssetId($templateId, $templateMock);
$trans->sendNotifications;
is(@templateVars, 2, '... called template->process twice');
my $inbox = WebGUI::Inbox->new($session);

View file

@ -519,6 +519,25 @@ sub originalConfig {
#----------------------------------------------------------------------------
=head2 cleanupAdminInbox ( )
Push a list of Asset objects onto the stack of assets to be automatically purged
at the end of the test. This will also clean-up all version tags associated
with the Asset.
This is a class method.
=cut
sub cleanupAdminInbox {
my $class = shift;
my $admin = WebGUI::User->new($class->session, '3');
my $inbox = WebGUI::Inbox->new($class->session);
$inbox->deleteMessagesForUser($admin);
}
#----------------------------------------------------------------------------
=head2 cleanupGuard ( $object, $class => $ident )
Pass in a list of objects or pairs of classes and identifiers, and