Merge branch 'master' of git@github.com:plainblack/webgui

This commit is contained in:
daviddelikat 2009-10-23 05:07:49 -05:00
commit 945017d762
46 changed files with 1496 additions and 492 deletions

View file

@ -121,6 +121,10 @@ is($att4->[1]->{url}, 'bar', 'rev still has bar');
is($att4->[2]->{url}, 'baz', 'rev does have new thing');
is(@$att4, 3, 'rev is proper size');
##This is a non-test. Duplicate URLs will not cause the test to blow-up with
##an untrappable error.
$template3rev->addAttachments([{ type => 'headScript', sequence => 3, url => 'baz'}]);
$template3rev->purgeRevision();
## Check how templates in the trash and clipboard are handled.
@ -168,6 +172,7 @@ like($brokenOutput, qr/$brokenUrl/, '... and the template url');
like($brokenOutput, qr/$brokenId/, '... and the template id');
like($logError, qr/$brokenUrl/, 'process: logged error has the url');
like($logError, qr/$brokenId/, '... and the template id');
WebGUI::Test->restoreLogging;
WebGUI::Test->tagsToRollback(WebGUI::VersionTag->getWorking($session));

View file

@ -57,7 +57,7 @@ use Data::Dumper;
use WebGUI::Asset::Wobject::Calendar;
use WebGUI::Asset::Event;
plan tests => 15 + scalar @icalWrapTests;
plan tests => 14 + scalar @icalWrapTests;
my $session = WebGUI::Test->session;
@ -221,6 +221,30 @@ my $justAfterwt = $windowCal->addChild({
timeZone => $tz,
}, undef, undef, {skipAutoCommitWorkflows => 1});
my $coincident = $windowCal->addChild({
className => 'WebGUI::Asset::Event',
title => 'Coincident with the window start and window end',
startDate => $startDt->toDatabaseDate,
endDate => $endDt->toDatabaseDate,
timeZone => $tz,
}, undef, undef, {skipAutoCommitWorkflows => 1});
my $coincidentLow = $windowCal->addChild({
className => 'WebGUI::Asset::Event',
title => 'Coincident with the window start',
startDate => $startDt->toDatabaseDate,
endDate => $endDt->clone->add(days => 1)->toDatabaseDate,
timeZone => $tz,
}, undef, undef, {skipAutoCommitWorkflows => 1});
my $coincidentHigh = $windowCal->addChild({
className => 'WebGUI::Asset::Event',
title => 'Coincident with the window end',
startDate => $startDt->clone->add( days => -1, )->toDatabaseDate,
endDate => $endDt->toDatabaseDate,
timeZone => $tz,
}, undef, undef, {skipAutoCommitWorkflows => 1});
# wt suffix = with times
# inside
# insidewt
@ -228,6 +252,9 @@ my $justAfterwt = $windowCal->addChild({
# |-------------straddlewt---------------|
# straddleLowwt
# straddleHighwt
# |----------coincident-----------|
# |----------coincidentLow------------------|
# |--------------------coincidentHigh-------|
# window: |-------------------------------|
# justBeforewt justAfterwt
# outside high
@ -239,7 +266,7 @@ my $tag2 = WebGUI::VersionTag->getWorking($session);
$tag2->commit;
WebGUI::Test->tagsToRollback($tag2);
is(scalar @{ $windowCal->getLineage(['children'])}, 10, 'added events to the window calendar');
is(scalar @{ $windowCal->getLineage(['children'])}, 13, 'added events to the window calendar');
my @window = $windowCal->getEventsIn($startDt->toDatabase, $endDt->toDatabase);
@ -247,11 +274,14 @@ my @window = $windowCal->getEventsIn($startDt->toDatabase, $endDt->toDatabase);
#note join "\n", map { join ' ', $_->get('title'), $_->get('startDate'), $_->get('startTime')} @window;
#note $endDt->toDatabase;
is(scalar @window, 6, 'getEventsIn returned 6 events');
cmp_bag(
[ map { $_->get('title') } @window ],
[ map { $_->get('title') } ($inside, $insidewt, $straddle, $straddleHighwt, $straddleLowwt, $straddlewt)],
'..returns correct 6 events'
[ map { $_->get('title') }
($inside, $insidewt,
$straddle, $straddleHighwt, $straddleLowwt, $straddlewt,
$coincident, $coincidentLow, $coincidentHigh, )
],
'..returns correct set of events'
);
######################################################################

View file

@ -0,0 +1,56 @@
# vim:syntax=perl
#-------------------------------------------------------------------
# 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 the unarchiveAll function of the collaboration system
#
#
use FindBin;
use strict;
use lib "$FindBin::Bin/../../../lib";
use Test::More;
use WebGUI::Test; # Must use this before any other WebGUI modules
use WebGUI::Session;
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
my $collab = WebGUI::Asset->getImportNode( $session )->addChild({
className => 'WebGUI::Asset::Wobject::Collaboration',
archiveAfter => 60*60*365.25,
});
# Add a thread
my @threads = (
$collab->addChild({
className => 'WebGUI::Asset::Post::Thread',
status => 'archived',
title => 'Archived',
}, undef, undef, { skipAutoCommitWorkflows => 1 }),
);
my $tag = WebGUI::VersionTag->getWorking( $session );
$tag->commit;
WebGUI::Test->tagsToRollback($tag);
#----------------------------------------------------------------------------
# Tests
plan tests => 1; # Increment this number for each test you create
#----------------------------------------------------------------------------
# www_unarchiveAll sets all threads to approved
$collab->www_unarchiveAll;
$threads[0] = WebGUI::Asset->newByDynamicClass( $session, $threads[0]->getId );
is( $threads[0]->get('status'), 'approved', "unarchiveAll sets thread to approved" );
#vim:ft=perl