all tests run individually

This commit is contained in:
Doug Bell 2010-11-17 19:31:44 -06:00
parent 1866c593ea
commit 6931fd471e
25 changed files with 157 additions and 159 deletions

View file

@ -163,7 +163,6 @@ sub importAssetData {
WebGUI::Asset->loadModule( $class );
my %properties = %{ $data->{properties} };
delete $properties{tagId};
if ($options->{inheritPermissions}) {
delete $properties{ownerUserId};
delete $properties{groupIdView};
@ -265,7 +264,6 @@ sub importPackage {
if $storage->getErrorCount;
my $package = undef; # The asset package
my $log = $self->session->log;
my $tag = WebGUI::VersionTag->getWorking( $self->session );
# The debug output for long requests would be too long, and we'd have to
# keep it all in memory.
@ -294,6 +292,11 @@ sub importPackage {
$decompressed->untar($storageId.".storage", $assetStorage);
}
if ( $options->{tagId} ) {
$data->{properties}{tagId} = $options->{tagId};
$data->{properties}{status} = "pending";
}
my $parentId = $data->{properties}->{parentId};
my $asset;
while ($asset = pop(@stack)) {

View file

@ -39,6 +39,7 @@ sub run {
(undef, undef, my $shortname) = File::Spec->splitpath($self->file);
$shortname =~ s/\.[^.]*$//;
$versionTag->set({name => "Upgrade to @{[$self->version]} - $shortname"});
$versionTag->setWorking;
my $package = $self->import_package($session, $self->file);
if (! $self->quiet) {
@ -56,6 +57,8 @@ sub import_package {
my $class = shift;
my ($session, $file) = @_;
my $versionTag = WebGUI::VersionTag->getWorking( $session, "nocreate" );
# Make a storage location for the package
my $storage = WebGUI::Storage->createTemp( $session );
$storage->addFileFromFilesystem( $file );
@ -67,6 +70,7 @@ sub import_package {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
tagId => ( $versionTag ? $versionTag->getId : undef ),
} );
}
catch {

View file

@ -60,23 +60,15 @@ $session->config->addToHash('adminConsole', 'test2', {
} );
# Add some assets
my $tag = WebGUI::VersionTag->getWorking( $session );
my $snip = $import->addChild( {
className => 'WebGUI::Asset::Snippet',
title => 'test',
groupIdEdit => '3',
synopsis => "aReallyLongWordToGetIndexed",
keywords => "AKeywordToGetIndexed",
tagId => $tag->getId,
status => "pending",
} );
# Commit the tag
$tag->commit;
addToCleanup( $tag );
# Reload snippet to get correct size
$snip = $snip->cloneFromDb;
$snip->commit;
addToCleanup( $snip );
#----------------------------------------------------------------------------
# Tests

View file

@ -42,6 +42,8 @@ my $props = {
className => 'WebGUI::Asset::Post::Thread',
content => 'hello, world!',
ownerUserId => 1,
status => "pending",
tagId => $versionTag->getId,
};
my $thread = $collab->addChild($props, @addArgs);
@ -71,10 +73,11 @@ $collab->update({threadsPerPage => 3, postsPerPage => 10,});
note 'getCSLinkUrl';
my @newThreads;
my $threadCount = 15;
my $versionTag2 = WebGUI::VersionTag->getWorking($session);
$props->{tagId} = $versionTag2->getId;
while ($threadCount--) {
push @newThreads, $collab->addChild($props, @addArgs);
}
my $versionTag2 = WebGUI::VersionTag->getWorking($session);
$versionTag2->commit;
my $csUrl = $collab->get('url');

View file

@ -27,23 +27,24 @@ my $node = WebGUI::Asset->getImportNode($session);
# Grab a named version tag
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Collab setup"});
my %tag = ( tagId => $versionTag->getId, status => "pending" );
# 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);
my $collab = $node->addChild({className => 'WebGUI::Asset::Wobject::Collaboration', %tag }, @addArgs);
# finally, add posts and threads to the collaboration system
my $first_thread = $collab->addChild(
{ className => 'WebGUI::Asset::Post::Thread', },
{ className => 'WebGUI::Asset::Post::Thread', %tag },
undef,
WebGUI::Test->webguiBirthday,
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
);
my $second_thread = $collab->addChild(
{ className => 'WebGUI::Asset::Post::Thread', },
{ className => 'WebGUI::Asset::Post::Thread', %tag },
undef,
WebGUI::Test->webguiBirthday,
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
@ -51,14 +52,14 @@ my $second_thread = $collab->addChild(
##Thread 1, Post 1 => t1p1
my $t1p1 = $first_thread->addChild(
{ className => 'WebGUI::Asset::Post', },
{ className => 'WebGUI::Asset::Post', %tag },
undef,
WebGUI::Test->webguiBirthday,
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
);
my $t1p2 = $first_thread->addChild(
{ className => 'WebGUI::Asset::Post', },
{ className => 'WebGUI::Asset::Post', %tag },
undef,
WebGUI::Test->webguiBirthday + 1,
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
@ -67,14 +68,14 @@ my $t1p2 = $first_thread->addChild(
my $past = time()-15;
my $t2p1 = $second_thread->addChild(
{ className => 'WebGUI::Asset::Post', },
{ className => 'WebGUI::Asset::Post', %tag },
undef,
$past,
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
);
my $t2p2 = $second_thread->addChild(
{ className => 'WebGUI::Asset::Post', },
{ className => 'WebGUI::Asset::Post', %tag },
undef,
undef,
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }

View file

@ -27,23 +27,24 @@ my $node = WebGUI::Asset->getImportNode($session);
# Grab a named version tag
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Collab setup"});
my %tag = ( tagId => $versionTag->getId, status => "pending" );
# 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);
my $collab = $node->addChild({className => 'WebGUI::Asset::Wobject::Collaboration', %tag }, @addArgs);
# finally, add posts and threads to the collaboration system
my $first_thread = $collab->addChild(
{ className => 'WebGUI::Asset::Post::Thread', },
{ className => 'WebGUI::Asset::Post::Thread', %tag },
undef,
WebGUI::Test->webguiBirthday,
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
);
my $second_thread = $collab->addChild(
{ className => 'WebGUI::Asset::Post::Thread', },
{ className => 'WebGUI::Asset::Post::Thread', %tag },
undef,
WebGUI::Test->webguiBirthday,
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
@ -51,14 +52,14 @@ my $second_thread = $collab->addChild(
##Thread 1, Post 1 => t1p1
my $t1p1 = $first_thread->addChild(
{ className => 'WebGUI::Asset::Post', },
{ className => 'WebGUI::Asset::Post', %tag },
undef,
WebGUI::Test->webguiBirthday,
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
);
my $t1p2 = $first_thread->addChild(
{ className => 'WebGUI::Asset::Post', },
{ className => 'WebGUI::Asset::Post', %tag },
undef,
WebGUI::Test->webguiBirthday + 1,
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
@ -67,14 +68,14 @@ my $t1p2 = $first_thread->addChild(
my $past = time()-15;
my $t2p1 = $second_thread->addChild(
{ className => 'WebGUI::Asset::Post', },
{ className => 'WebGUI::Asset::Post', %tag },
undef,
$past,
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
);
my $t2p2 = $second_thread->addChild(
{ className => 'WebGUI::Asset::Post', },
{ className => 'WebGUI::Asset::Post', %tag },
undef,
undef,
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }

View file

@ -22,8 +22,9 @@ my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Snippet Test"});
my %tag = ( tagId => $versionTag->getId, status => "pending" );
addToCleanup($versionTag);
my $snippet = $node->addChild({className=>'WebGUI::Asset::Snippet'});
my $snippet = $node->addChild({className=>'WebGUI::Asset::Snippet', %tag});
# Test for a sane object type
isa_ok($snippet, 'WebGUI::Asset::Snippet');
@ -81,7 +82,7 @@ $session->config->addToHash('macros', 'SQL', 'SQL');
is($snippet->view(), 'WebGUI', 'Interpolating macros in works with template in the correct order');
my $empty = $node->addChild( { className => 'WebGUI::Asset::Snippet', } );
my $empty = $node->addChild( { className => 'WebGUI::Asset::Snippet', %tag } );
is($empty->www_view, 'empty', 'www_view: snippet with no content returns "empty"');
#----------------------------------------------------------------------
@ -102,8 +103,9 @@ is $snippet->view(1), 'Cache test: 3', 'receive uncached content since view was
#----------------------------------------------------------------------
#Check packing
my $snippet2 = $node->addChild({className => 'WebGUI::Asset::Snippet'});
my $tag2 = WebGUI::VersionTag->getWorking($session);
$tag{tagId} = $tag2->getId;
my $snippet2 = $node->addChild({className => 'WebGUI::Asset::Snippet', %tag});
$snippet2->update({mimeType => 'text/javascript'});
$tag2->commit;
addToCleanup($tag2);

View file

@ -22,6 +22,9 @@ use Test::Exception;
use JSON qw{ from_json };
my $session = WebGUI::Test->session;
my $tag = WebGUI::VersionTag->getWorking($session);
addToCleanup( $tag );
my %tag = ( tagId => $tag->getId, status => "pending" );
my $list = WebGUI::Asset::Template->getList($session);
cmp_deeply($list, {}, 'getList with no classname returns an empty hashref');
@ -38,7 +41,7 @@ ok($output =~ m/true/, "processRaw() - conditionals");
ok($output =~ m/\s(?:XY){5}\s/, "processRaw() - loops");
my $importNode = WebGUI::Asset::Template->getImportNode($session);
my $template = $importNode->addChild({className=>"WebGUI::Asset::Template", title=>"test", url=>"testingtemplates", template=>$tmplText, namespace=>'WebGUI Test Template'});
my $template = $importNode->addChild({className=>"WebGUI::Asset::Template", title=>"test", url=>"testingtemplates", template=>$tmplText, namespace=>'WebGUI Test Template', %tag});
isa_ok($template, 'WebGUI::Asset::Template', "creating a template");
is($template->get('parser'), 'WebGUI::Asset::Template::HTMLTemplate', 'default parser is HTMLTemplate');
@ -76,6 +79,7 @@ my $template3 = $importNode->addChild({
className => "WebGUI::Asset::Template",
title => 'headBlock test',
template => "this is a template",
%tag,
}, undef, time()-5);
my @atts = (
@ -108,7 +112,7 @@ cmp_bag(
'attachments are duplicated'
) or diag( Dumper \@atts3dup );
my $template3rev = $template3->addRevision();
my $template3rev = $template3->addRevision({%tag});
my $att4 = $template3rev->getAttachments('headScript');
is($att4->[0]->{url}, 'foo', 'rev has foo');
is($att4->[1]->{url}, 'bar', 'rev has bar');
@ -167,6 +171,7 @@ my $trashTemplate = $importNode->addChild({
className => "WebGUI::Asset::Template",
title => 'Trash template',
template => q|Trash Trash Trash Trash|,
%tag
});
$trashTemplate->trash;
@ -191,6 +196,7 @@ my $brokenTemplate = $importNode->addChild({
className => "WebGUI::Asset::Template",
title => 'Broken template',
template => q|<tmpl_if unclosedIf>If clause with no ending tag|,
%tag
});
WebGUI::Test->interceptLogging( sub {
@ -205,14 +211,13 @@ WebGUI::Test->interceptLogging( sub {
like($log_data->{error}, qr/$brokenId/, '... and the template id');
});
WebGUI::Test->addToCleanup(WebGUI::VersionTag->getWorking($session));
my $userStyleTemplate = $importNode->addChild({
className => "WebGUI::Asset::Template",
title => "user function style",
url => "ufs",
template => "user function style",
namespace => 'WebGUI Test Template',
%tag
});
my $someOtherTemplate = $importNode->addChild({
@ -221,13 +226,11 @@ my $someOtherTemplate = $importNode->addChild({
url => "sot",
template => "some other template",
namespace => 'WebGUI Test Template',
%tag
});
$session->setting->set('userFunctionStyleId', $userStyleTemplate->getId);
my $purgeCutTag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($purgeCutTag);
is($session->setting->get('userFunctionStyleId'), $userStyleTemplate->getId, 'Setup for cut tests.');
$userStyleTemplate->cut;

View file

@ -36,11 +36,7 @@ my $wikipage = $wiki->addChild(
@autoCommitCoda,
);
# Wikis create and autocommit a version tag when a child is added. Lets get the name so we can roll it back.
my $secondVersionTag = WebGUI::VersionTag->new($session,$wikipage->get("tagId"));
$secondVersionTag->commit;
WebGUI::Test->addToCleanup($secondVersionTag );
my $wikipage = $wikipage->cloneFromDb;
WebGUI::Test->addToCleanup($wikipage);
# Test for sane object types
isa_ok($wiki, 'WebGUI::Asset::Wobject::WikiMaster');

View file

@ -23,6 +23,7 @@ my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Wiki Test"});
my %tag = ( tagId => $versionTag->getId, status => "pending" );
addToCleanup($versionTag);
my $assetEdit = WebGUI::Group->new($session, "new");
@ -47,6 +48,7 @@ my $wiki = $node->addChild({
groupToAdminister => $wikiAdmin->getId,
groupToEditPages => $wikiEditPage->getId,
ownerUserId => $wikiOwner->getId,
%tag,
}, undef, undef, {skipAutoCommitWorkflows => 1, skipNotification => 1});
$versionTag->commit;
my $wikipage = $wiki->addChild({
@ -55,10 +57,7 @@ my $wikipage = $wiki->addChild({
}, undef, undef, {skipAutoCommitWorkflows => 1, skipNotification => 1});
is $wikipage->get('ownerUserId'), $wikiPageOwner->userId, 'wiki page owned by correct user';
# Wikis create and autocommit a version tag when a child is added. Lets get the name so we can roll it back.
my $secondVersionTag = WebGUI::VersionTag->new($session,$wikipage->get("tagId"));
$secondVersionTag->commit;
addToCleanup($secondVersionTag );
addToCleanup($wikipage);
# Test for sane object types
isa_ok($wiki, 'WebGUI::Asset::Wobject::WikiMaster');

View file

@ -34,9 +34,10 @@ my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
addToCleanup($versionTag);
$versionTag->set({name => 'Collaboration => groupToEditPost test'});
my %tag = ( tagId => $versionTag->getId, status => "pending" );
# place the collab system under a layout to ensure we're using the inherited groupIdEdit value
my $layout = $node->addChild({className => 'WebGUI::Asset::Wobject::Layout'});
my $layout = $node->addChild({className => 'WebGUI::Asset::Wobject::Layout', %tag});
# set the layout as the current asset for the same reason
$session->asset($layout);
@ -45,6 +46,7 @@ $session->asset($layout);
my $collab = $layout->addChild({
className => 'WebGUI::Asset::Wobject::Collaboration',
url => 'collab',
%tag,
});
$versionTag->commit;
@ -62,25 +64,28 @@ cmp_ok($collab->get('groupToEditPost'), 'eq', $collab->get('groupIdEdit'), 'grou
is($collab->get('itemsPerFeed'), 25, 'itemsPerFeed is set to the default');
# finally, add the post to the collaboration system
my $tag1 = WebGUI::VersionTag->getWorking($session);
my $props = {
className => 'WebGUI::Asset::Post::Thread',
content => 'hello, world!',
status => "pending",
tagId => $tag1->getId,
};
my $thread = $collab->addChild($props, @addChildCoda);
my $tag1 = WebGUI::VersionTag->getWorking($session);
$tag1->commit;
addToCleanup($tag1);
# Test for a sane object type
isa_ok($thread, 'WebGUI::Asset::Post::Thread');
my $tag2 = WebGUI::VersionTag->getWorking($session);
$props = {
className => 'WebGUI::Asset::Post::Thread',
content => 'jello, world!',
status => "pending",
tagId => $tag2->getId,
};
my $thread2 = $collab->addChild($props, @addChildCoda);
my $tag2 = WebGUI::VersionTag->getWorking($session);
$tag2->commit;
addToCleanup($tag2);
@ -94,7 +99,6 @@ is($collab->getAtomFeedUrl, '/collab?func=viewAtom', 'getAtomFeedUrl');
note "Mail Cron job tests";
my $dupedCollab = $collab->duplicate();
addToCleanup(WebGUI::VersionTag->new($session, $dupedCollab->get('tagId')));
ok($dupedCollab->get('getMailCronId'), 'Duplicated CS has a cron job');
isnt($dupedCollab->get('getMailCronId'), $collab->get('getMailCronId'), '... and it is different from its source asset');
@ -107,10 +111,11 @@ $thread2->archive();
$collab = $collab->cloneFromDb;
is $collab->get('threads'), 1, 'CS lost 1 thread due to archiving';
my $thread3 = $collab->addChild($props, @addChildCoda);
my $tag3 = WebGUI::VersionTag->getWorking($session);
$tag3->commit;
addToCleanup($tag3);
my $thread3 = $collab->addChild({
className => 'WebGUI::Asset::Post::Thread',
content => "Again!",
}, @addChildCoda);
$thread3->commit;
$collab = $collab->cloneFromDb;
is $collab->get('threads'), 2, '... added 1 thread';

View file

@ -21,10 +21,12 @@ use WebGUI::Session;
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
$session->user({ userId => '3' });
my $collab = WebGUI::Asset->getImportNode( $session )->addChild({
className => 'WebGUI::Asset::Wobject::Collaboration',
archiveAfter => 60*60*365.25,
groupIdEdit => '3',
});
# Add a thread
@ -33,12 +35,12 @@ my @threads = (
className => 'WebGUI::Asset::Post::Thread',
status => 'archived',
title => 'Archived',
}, undef, undef, { skipAutoCommitWorkflows => 1 }),
groupIdEdit => '3',
}),
);
$_->commit for @threads;
my $tag = WebGUI::VersionTag->getWorking( $session );
$tag->commit;
WebGUI::Test->addToCleanup($tag);
WebGUI::Test->addToCleanup($collab,@threads);
#----------------------------------------------------------------------------
# Tests
@ -47,8 +49,9 @@ plan tests => 1; # Increment this number for each test you create
#----------------------------------------------------------------------------
# www_unarchiveAll sets all threads to approved
note( $threads[0]->status );
$collab->www_unarchiveAll;
$threads[0] = WebGUI::Asset->newById( $session, $threads[0]->getId );
$threads[0] = $threads[0]->cloneFromDb;
is( $threads[0]->get('status'), 'approved', "unarchiveAll sets thread to approved" );
#vim:ft=perl

View file

@ -44,6 +44,7 @@ my $node = WebGUI::Asset->getImportNode($session);
# Create a version tag to work in
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"EventManagementSystem Test"});
my %tag = ( tagId => $versionTag->getId, status => "pending" );
#----------------------------------------------------------------------------
# Tests
@ -67,7 +68,8 @@ my $ems = $node->addChild({
url => '/test-ems',
workflowIdCommit => 'pbworkflow000000000003', # Commit Content Immediately
registrationStaffGroupId => $registrars->getId,
groupIdView => $attendees->getId
groupIdView => $attendees->getId,
%tag
});
$versionTag->commit;
WebGUI::Test->addToCleanup($versionTag);

View file

@ -32,17 +32,14 @@ my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set( { name=>"Gallery Search Test" } );
my %tag = ( tagId => $versionTag->getId, status => "pending" );
addToCleanup( $versionTag );
# Create gallery and a single album
my $gallery
= $node->addChild({
className => "WebGUI::Asset::Wobject::Gallery",
},
undef,
undef,
{
skipAutoCommitWorkflows => 1,
%tag,
});
my $album
@ -51,11 +48,7 @@ my $album
title => "album",
synopsis => "synopsis2",
keywords => "group2",
},
undef,
undef,
{
skipAutoCommitWorkflows => 1,
%tag,
});
my $albumId = $album->getId;
@ -67,11 +60,7 @@ my $photo1
synopsis => "synopsis1",
keywords => "group1",
location => "Heidelberg",
},
undef,
undef,
{
skipAutoCommitWorkflows => 1,
%tag,
});
my $id1 = $photo1->getId;
@ -82,11 +71,7 @@ my $photo2
synopsis => "synopsis2",
keywords => "group1",
location => "Mannheim",
},
undef,
undef,
{
skipAutoCommitWorkflows => 1,
%tag,
});
my $id2 = $photo2->getId;
@ -97,11 +82,7 @@ my $photo3
synopsis => "synopsis1",
keywords => "group2",
location => "Mannheim",
},
undef,
undef,
{
skipAutoCommitWorkflows => 1,
%tag,
});
my $id3 = $photo3->getId;

View file

@ -23,7 +23,7 @@ use Test::Deep;
my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
my %tag = ( tagId => $versionTag->getId, status => "pending" );
$versionTag->set({name=>"Add Archive to Album Test"});
addToCleanup($versionTag);
@ -35,26 +35,16 @@ my $gallery
groupIdView => 7, # Everyone
groupIdEdit => 3, # Admins
ownerUserId => 3, # Admin
%tag,
});
my $album
= $gallery->addChild({
className => "WebGUI::Asset::Wobject::GalleryAlbum",
ownerUserId => "3", # Admin
},
undef,
undef,
{
skipAutoCommitWorkflows => 1,
%tag,
});
# Properties applied to every photo in the archive
my $properties = {
keywords => "something",
location => "somewhere",
friendsOnly => "1",
};
$versionTag->commit;
@ -68,6 +58,15 @@ plan tests => 11;
# elephant_images.zip contains three jpgs: Aana1.jpg, Aana2.jpg, Aana3.jpg
$versionTag = WebGUI::VersionTag->getWorking($session);
# Properties applied to every photo in the archive
my $properties = {
keywords => "something",
location => "somewhere",
friendsOnly => "1",
tagId => $versionTag->getId,
status => "pending",
};
$album->addArchive( WebGUI::Test->getTestCollateralPath('elephant_images.zip'), $properties );
my $images = $album->getLineage(['descendants'], { returnObjects => 1 });
@ -129,6 +128,7 @@ $versionTag->rollback;
# it's machine dependent.
$versionTag = WebGUI::VersionTag->getWorking($session);
$properties->{tagId} = $versionTag->getId;
# Add photos sorted by file order (default)
$album->addArchive( WebGUI::Test->getTestCollateralPath('gallery_archive_sorting_test.zip'), $properties, 'fileOrder' );
# Get all children
@ -143,6 +143,7 @@ cmp_deeply(
$versionTag->rollback;
$versionTag = WebGUI::VersionTag->getWorking($session);
$properties->{tagId} = $versionTag->getId;
# Add photos sorted by date
$album->addArchive( WebGUI::Test->getTestCollateralPath('gallery_archive_sorting_test.zip'), $properties, 'date' );
# Get all children
@ -157,6 +158,7 @@ cmp_deeply(
$versionTag->rollback;
$versionTag = WebGUI::VersionTag->getWorking($session);
$properties->{tagId} = $versionTag->getId;
# Add photos sorted by name
$album->addArchive( WebGUI::Test->getTestCollateralPath('gallery_archive_sorting_test.zip'), $properties, 'name' );
# Get all children

View file

@ -26,6 +26,7 @@ my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($versionTag);
my %tag = ( tagId => $versionTag->getId, status => "pending" );
$versionTag->set({name=>"Album Test"});
my $gallery
= $node->addChild({
@ -35,16 +36,13 @@ my $gallery
groupIdView => 2, # Registered Users
groupIdEdit => 3, # Admins
ownerUserId => 3, # Admin
%tag,
});
my $album
= $gallery->addChild({
className => "WebGUI::Asset::Wobject::GalleryAlbum",
ownerUserId => "3", # Admin
},
undef,
undef,
{
skipAutoCommitWorkflows => 1,
%tag,
});
my @photos;
for my $i ( 0 .. 5 ) {
@ -52,11 +50,7 @@ for my $i ( 0 .. 5 ) {
= $album->addChild({
className => "WebGUI::Asset::File::GalleryFile::Photo",
filename => "$i.jpg",
},
undef,
undef,
{
skipAutoCommitWorkflows => 1,
%tag,
});
}

View file

@ -26,9 +26,10 @@ my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
my %tag = ( tagId => $versionTag->getId, status => "pending" );
$versionTag->set({name=>"Matrix Test"});
WebGUI::Test->addToCleanup($versionTag);
my $matrix = $node->addChild({className=>'WebGUI::Asset::Wobject::Matrix'});
my $matrix = $node->addChild({className=>'WebGUI::Asset::Wobject::Matrix',%tag});
# Test for a sane object type
isa_ok($matrix, 'WebGUI::Asset::Wobject::Matrix');
@ -102,12 +103,9 @@ is($newAttribute->{attributeId},undef,"The new attribute was successfully delete
# add a listing
my $matrixListing = $matrix->addChild({className=>'WebGUI::Asset::MatrixListing'}, undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1});
my $matrixListing = $matrix->addChild({className=>'WebGUI::Asset::MatrixListing'}, undef, undef, { skipNotification => 1});
my $secondVersionTag = WebGUI::VersionTag->new($session,$matrixListing->get("tagId"));
$secondVersionTag->commit;
WebGUI::Test->addToCleanup($secondVersionTag);
$matrixListing = $matrixListing->cloneFromDb;
WebGUI::Test->addToCleanup($matrixListing);
# Test for sane object type
isa_ok($matrixListing, 'WebGUI::Asset::MatrixListing');

View file

@ -27,8 +27,9 @@ my $node = WebGUI::Asset->getDefault($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Search Test"});
my %tag = ( tagId => $versionTag->getId, status => "pending" );
addToCleanup($versionTag);
my $search = $node->addChild({className=>'WebGUI::Asset::Wobject::Search'});
my $search = $node->addChild({className=>'WebGUI::Asset::Wobject::Search', %tag});
# Test for a sane object type
isa_ok($search, 'WebGUI::Asset::Wobject::Search');
@ -88,12 +89,14 @@ $search->update({
{
my $versionTag2 = WebGUI::VersionTag->getWorking($session);
$tag{tagId} = $versionTag2->getId;
$versionTag2->set({name=>"Collab setup"});
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1 } );
my @addArgs = ( undef, undef, { skipNotification => 1 } );
my $collab = $node->addChild({
className => 'WebGUI::Asset::Wobject::Collaboration',
editTimeout => '1',
threadsPerPage => 3,
%tag,
},
@addArgs);
# finally, add the post to the collaboration system
@ -101,6 +104,7 @@ $search->update({
className => 'WebGUI::Asset::Post::Thread',
content => 'verbosity shale anything',
ownerUserId => 1,
%tag,
};
my $thread = $collab->addChild($props, @addArgs);

View file

@ -26,25 +26,31 @@ $session->user({userId => 3});
my $node = WebGUI::Asset->getImportNode($session);
my $tag2 = WebGUI::VersionTag->getWorking($session);
my %tag = ( tagId => $tag2->getId, status => "pending" );
my $default = WebGUI::Asset->getDefault($session);
my $importArticle = $node->addChild({
className => 'WebGUI::Asset::Wobject::Article',
description => 'rockhound',
%tag,
});
my $defaultArticle = $default->addChild({
className => 'WebGUI::Asset::Wobject::Article',
description => 'rockhound',
%tag,
});
my $template = $node->addChild({
className => 'WebGUI::Asset::Template',
template => qq{[<tmpl_loop result_set>"<tmpl_var assetId>"<tmpl_unless __LAST__>,</tmpl_unless></tmpl_loop>]},
%tag,
});
my $search = $default->addChild({
className => 'WebGUI::Asset::Wobject::Search',
searchRoot => $default->getId,
templateId => $template->getId,
%tag,
});
my $tag2 = WebGUI::VersionTag->getWorking($session);
$tag2->commit;
$search->prepareView();

View file

@ -73,13 +73,15 @@ my @skipAutoCommit = WebGUI::Test->getAssetSkipCoda;
my $home = WebGUI::Asset->getDefault($session);
$versionTag = WebGUI::VersionTag->getWorking($session);
my %tag = ( tagId => $versionTag->getId, status => "pending" );
$archive = $home->addChild({
className => 'WebGUI::Asset::Wobject::StoryArchive',
title => 'My Stories',
url => '/home/mystories',
styleTemplateId => $home->get('styleTemplateId'),
%tag,
});
$versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
WebGUI::Test->addToCleanup($versionTag);
$archive = $archive->cloneFromDb;
@ -192,8 +194,9 @@ isa_ok($child, 'WebGUI::Asset::Wobject::Folder', '... will add folders, so impor
$child->purge;
$child = $archive->addChild({className => 'WebGUI::Asset::Story', title => 'First Story'}, @skipAutoCommit);
my $tag1 = WebGUI::VersionTag->getWorking($session);
$tag{tagId} = $tag1->getId;
$child = $archive->addChild({className => 'WebGUI::Asset::Story', title => 'First Story', %tag}, @skipAutoCommit);
$tag1->commit;
WebGUI::Test->addToCleanup($tag1);
isa_ok($child, 'WebGUI::Asset::Story', 'addChild added and returned a Story');
@ -229,9 +232,10 @@ my $newFolder = $archive->getFolder($yesterday);
my ($wgBdayMorn,undef) = $session->datetime->dayStartEnd($wgBday);
my ($yesterdayMorn,undef) = $session->datetime->dayStartEnd($yesterday);
my $story = $oldFolder->addChild({ className => 'WebGUI::Asset::Story', title => 'WebGUI is released', keywords => 'roger,foxtrot,echo,all'}, @skipAutoCommit);
$creationDateSth->execute([$wgBday, $story->getId]);
my $tag2 = WebGUI::VersionTag->getWorking($session);
$tag{tagId} = $tag2->getId;
my $story = $oldFolder->addChild({ className => 'WebGUI::Asset::Story', title => 'WebGUI is released', keywords => 'roger,foxtrot,echo,all', %tag}, @skipAutoCommit);
$creationDateSth->execute([$wgBday, $story->getId]);
$tag2->commit;
WebGUI::Test->addToCleanup($tag2);
@ -240,9 +244,10 @@ WebGUI::Test->addToCleanup($tag2);
is ($storyDB->get('status'), 'approved', 'addRevision always calls for an autocommit');
}
my $pastStory = $newFolder->addChild({ className => 'WebGUI::Asset::Story', title => "Yesterday is history" }, @skipAutoCommit);
$creationDateSth->execute([$yesterday, $pastStory->getId]);
my $tag3 = WebGUI::VersionTag->getWorking($session);
$tag{tagId} = $tag3->getId;
my $pastStory = $newFolder->addChild({ className => 'WebGUI::Asset::Story', title => "Yesterday is history", %tag }, @skipAutoCommit);
$creationDateSth->execute([$yesterday, $pastStory->getId]);
$tag3->commit;
WebGUI::Test->addToCleanup($tag3);
@ -311,14 +316,15 @@ cmp_deeply(
'viewTemplateVariables: returns expected template variables with 3 stories in different folders, user is cannot edit stories'
);
my $story2 = $folder->addChild({ className => 'WebGUI::Asset::Story', title => 'Story 2', keywords => "roger,foxtrot,all"}, @skipAutoCommit);
my $story3 = $folder->addChild({ className => 'WebGUI::Asset::Story', title => 'Story 3', keywords => "foxtrot,echo,all"}, @skipAutoCommit);
my $story4 = $folder->addChild({ className => 'WebGUI::Asset::Story', title => 'Story 4', keywords => "roger,echo,all"}, @skipAutoCommit);
my $tag4 = WebGUI::VersionTag->getWorking($session);
$tag{tagId} = $tag4->getId;
my $story2 = $folder->addChild({ className => 'WebGUI::Asset::Story', title => 'Story 2', keywords => "roger,foxtrot,all", %tag}, @skipAutoCommit);
my $story3 = $folder->addChild({ className => 'WebGUI::Asset::Story', title => 'Story 3', keywords => "foxtrot,echo,all", %tag}, @skipAutoCommit);
my $story4 = $folder->addChild({ className => 'WebGUI::Asset::Story', title => 'Story 4', keywords => "roger,echo,all", %tag}, @skipAutoCommit);
foreach my $storilet ($story2, $story3, $story4) {
$session->db->write("update asset set creationDate=$now where assetId=?",[$storilet->getId]);
}
$archive->update({storiesPerPage => 3});
my $tag4 = WebGUI::VersionTag->getWorking($session);
$tag4->commit;
WebGUI::Test->addToCleanup($tag4);

View file

@ -38,19 +38,23 @@ plan tests => 5; # Increment this number for each test you create
my $output;
my $node = WebGUI::Asset->getImportNode($session);
my $root = WebGUI::Asset->getRoot( $session );
my $tag = WebGUI::VersionTag->getWorking( $session );
my %tag = ( tagId => $tag->getId, status => "pending" );
my $top = $node->addChild({
className => 'WebGUI::Asset::Wobject::Layout',
title => 'Top',
%tag,
} );
my $child = $top->addChild({
className => 'WebGUI::Asset::Wobject::Layout',
title => 'Child',
%tag,
});
my $grand = $child->addChild({
className => 'WebGUI::Asset::Snippet',
title => 'Grand',
%tag,
});
my $tag = WebGUI::VersionTag->getWorking( $session );
$tag->commit;
addToCleanup( $tag );

View file

@ -44,6 +44,8 @@ $versionTag->setWorking;
template => '',
namespace => 'style',
className => 'WebGUI::Asset::Template',
tagId => $versionTag->getId,
status => "pending",
} );
$elem->setOptions;

View file

@ -128,12 +128,6 @@ $upgrade->testUpgrade('config.pl');
ok !$hasSession, 'session properly closed';
}
{
my $vt = $upgrade->testUpgrade('versiontag-implicit.pl');
ok $vt->get('isCommitted'), 'implicit version tag committed';
is $vt->get('name'), 'Upgrade to 8.3.0 - versiontag-implicit', 'implicit version tag named correctly';
}
$upgrade->testUpgrade('versiontag.pl');
$upgrade->testUpgrade('collateral.pl');
$upgrade->testUpgrade('package.pl');

View file

@ -159,22 +159,24 @@ $tag2->rollback;
($tag, $tagAgain1, $tag2, $tagAgain2) = ();
my $tag3 = WebGUI::VersionTag->create($session, {});
my %tag = ( tagId => $tag3->getId, status => "pending" );
$tag3->setWorking;
my $asset1 = WebGUI::Asset->getRoot($session)->addChild({ className => 'WebGUI::Asset::Snippet' });
my $asset2 = WebGUI::Asset->getRoot($session)->addChild({ className => 'WebGUI::Asset::Snippet' });
my $asset1 = WebGUI::Asset->getRoot($session)->addChild({ className => 'WebGUI::Asset::Snippet', %tag });
my $asset2 = WebGUI::Asset->getRoot($session)->addChild({ className => 'WebGUI::Asset::Snippet', %tag });
is($tag3->getAssetCount, 2, 'tag with two assets');
is($tag3->getRevisionCount, 2, 'tag with two revisions');
$asset1 = $asset1->addRevision({ title => 'revised once' }, time+10);
$asset1 = $asset1->addRevision({ title => 'revised twice' }, time+20);
$asset2 = $asset2->addRevision({ title => 'other revised once' }, time+30);
$asset1 = $asset1->addRevision({ title => 'revised once', %tag }, time+10);
$asset1 = $asset1->addRevision({ title => 'revised twice', %tag }, time+20);
$asset2 = $asset2->addRevision({ title => 'other revised once', %tag }, time+30);
is($tag3->getRevisionCount, 5, 'tag with five revisions');
my $tag4 = WebGUI::VersionTag->create($session, {});
$tag{tagId} = $tag4->getId;
$tag4->setWorking;
my $asset3 = WebGUI::Asset->getRoot($session)->addChild({ className => 'WebGUI::Asset::Snippet' });
my $asset3 = WebGUI::Asset->getRoot($session)->addChild({ className => 'WebGUI::Asset::Snippet', %tag });
is($tag4->getAssetCount, 1, 'other tag with one asset');
is($tag4->getRevisionCount, 1, 'other tag with one revision');
$asset3->addRevision({ title => 'again revised once' }, time+40);
$asset3->addRevision({ title => 'again revised once', %tag }, time+40);
is($tag4->getRevisionCount, 2, 'other tag still with one asset');
is($tag4->getRevisionCount, 2, 'other tag with two revisions');
is($tag3->getAssetCount, 2, 'original tag still with two assets');
@ -185,8 +187,9 @@ $tag4->rollback;
#Test commitAsUser
my $tag5 = WebGUI::VersionTag->create($session, {});
$tag{tagId} = $tag5->getId;
$tag5->setWorking;
my $asset5 = WebGUI::Asset->getRoot($session)->addChild({ className => 'WebGUI::Asset::Snippet' });
my $asset5 = WebGUI::Asset->getRoot($session)->addChild({ className => 'WebGUI::Asset::Snippet', %tag });
is($tag5->get("createdBy"),1,'tag created by visitor');
$tag5->commitAsUser(3);
$tag5 = WebGUI::VersionTag->new($session, $tag5->getId); #Get the tag again - properties have changed
@ -196,8 +199,9 @@ $tag5->rollback;
#Test commitAsUser with options
my $tag6 = WebGUI::VersionTag->create($session, {});
$tag{tagId} = $tag6->getId;
$tag6->setWorking;
my $asset6 = WebGUI::Asset->getRoot($session)->addChild({ className => 'WebGUI::Asset::Snippet' });
my $asset6 = WebGUI::Asset->getRoot($session)->addChild({ className => 'WebGUI::Asset::Snippet', %tag });
$tag6->commitAsUser(3, { commitNow => "yes" });
$tag6 = WebGUI::VersionTag->new($session, $tag6->getId); #Get the tag again - properties have changed
is($tag6->get("committedBy"),3,'tag committed by admin again');
@ -321,8 +325,9 @@ $siteWideTag->rollback();
setUserVersionTagMode($user, q{singlePerUser});
my $tag = WebGUI::VersionTag->create($session, {});
$tag{ tagId } = $tag->getId;
$tag->setWorking;
my $asset = WebGUI::Asset->getRoot($session)->addChild({ className => 'WebGUI::Asset::Snippet' });
my $asset = WebGUI::Asset->getRoot($session)->addChild({ className => 'WebGUI::Asset::Snippet', %tag });
is($tag->getAssetCount, 1, qq{$test_prefix [singlePerUser] tag with 1 asset});
# create admin session
@ -372,8 +377,9 @@ $siteWideTag->rollback();
setUserVersionTagMode($user, q{siteWide});
$tag = WebGUI::VersionTag->create($session, {});
$tag{tagId} = $tag->getId;
$tag->setWorking;
$asset = WebGUI::Asset->getRoot($session)->addChild({ className => 'WebGUI::Asset::Snippet' });
$asset = WebGUI::Asset->getRoot($session)->addChild({ className => 'WebGUI::Asset::Snippet', %tag });
is($tag->getAssetCount, 1, qq{$test_prefix [siteWide] tag with 1 asset});
# create admin session

View file

@ -1,13 +0,0 @@
use WebGUI::Upgrade::Script;
use WebGUI::Asset;
use WebGUI::Asset::Snippet;
WebGUI::Asset->getRoot(session)->addChild({
className => 'WebGUI::Asset::Snippet',
title => 'Test snippet',
});
my $vt = WebGUI::VersionTag->getWorking(session, 'nocreate');
if ($vt) {
::addToCleanup('WebGUI::VersionTag', $vt->getId);
}
$vt;