Make version tags mandatory again.

This commit is contained in:
Colin Kuskie 2011-10-25 19:44:58 -07:00
parent d0b3be1749
commit 4bfabb9469
94 changed files with 405 additions and 489 deletions

View file

@ -281,15 +281,6 @@ processPropertiesFromFormPost
-----------------------------
Absurdly long and non-descriptive name, changed to processEditForm
Versioning
----------
New revisions are not created in a "pending" state automatically. VersionTags
are not created by calling addRevision(). If you want a revision to be part of
a version tag, you must set
status => "pending",
tagId => $tag->getId,
explicitly.
Admin Controls
--------------------
The admin controls are now added to the asset with javascript. This javascript

View file

@ -2776,40 +2776,12 @@ sub www_addSave {
return $self->session->style->userStyle($i18n->get("over max assets")) if ($self->session->config->get("maximumAssets") <= $count);
}
# Determine what version tag we should use
my $autoCommitId = $self->getAutoCommitWorkflowId();
my ($workingTag, $oldWorking);
if ( $autoCommitId ) {
$workingTag
= WebGUI::VersionTag->create( $session, {
groupToUse => '12', # Turn Admin On (for lack of something better)
workflowId => $autoCommitId,
} );
}
else {
my $parentAsset;
if ( not defined( $parentAsset = $self->getParent ) ) {
$parentAsset = WebGUI::Asset->newPending( $session, $self->parentId );
}
if ( $parentAsset->hasBeenCommitted ) {
$workingTag = WebGUI::VersionTag->getWorking( $session );
}
else {
$oldWorking = WebGUI::VersionTag->getWorking($session, 'noCreate');
$workingTag = WebGUI::VersionTag->new( $session, $parentAsset->tagId );
$workingTag->setWorking();
}
}
# Add the new asset
my $object;
my $className = $form->process('className','className') || $form->process('class','className');
$object = $self->addChild({
className => $className,
revisedBy => $session->user->userId,
tagId => $workingTag->getId,
status => "pending",
});
if ( !defined $object ) {
my $url = $session->url->page;
@ -2819,11 +2791,6 @@ sub www_addSave {
$object->{_parent} = $self;
$object->url(undef);
# More version tag stuff
$object->setVersionLock;
$object->setAutoCommitTag($workingTag) if (defined $autoCommitId);
$oldWorking->setWorking if $oldWorking;
# Process properties from form post
my $errors = $object->processEditForm;
if (ref $errors eq 'ARRAY') {
@ -2924,43 +2891,8 @@ sub www_editSave {
return $session->privilege->locked() unless $self->canEditIfLocked;
return $session->privilege->insufficient() unless $self->canEdit;
# Determine what version tag we should use
my $autoCommitId = $self->getAutoCommitWorkflowId();
my ($workingTag, $oldWorking);
if ( $autoCommitId ) {
$workingTag
= WebGUI::VersionTag->create( $session, {
groupToUse => '12', # Turn Admin On (for lack of something better)
workflowId => $autoCommitId,
} );
}
else {
my $parentAsset;
if ( not defined( $parentAsset = $self->getParent ) ) {
$parentAsset = WebGUI::Asset->newPending( $session, $self->parentId );
}
if ( $parentAsset->hasBeenCommitted ) {
$workingTag = WebGUI::VersionTag->getWorking( $session );
}
else {
$oldWorking = WebGUI::VersionTag->getWorking($session, 'noCreate');
$workingTag = WebGUI::VersionTag->new( $session, $parentAsset->tagId );
$workingTag->setWorking();
}
}
# Add the new revision
my $object = $self->addRevision({
revisedBy => $session->user->userId,
tagId => $workingTag->getId,
status => "pending",
});
# More version tag stuff
$object->setVersionLock;
$object->setAutoCommitTag($workingTag) if (defined $autoCommitId);
$oldWorking->setWorking if $oldWorking;
my $object = $self->addRevision();
# Process properties from form post
my $errors = $object->processEditForm;

View file

@ -98,11 +98,14 @@ property seatsAvailable => (
property startDate => (
noFormPost => 1,
fieldType => "dateTime",
default => '',
builder => '_default_startDate',
label => [ "add/edit event start date", 'Asset_EMSSubmission' ],
hoverHelp => [ "add/edit event start date help", 'Asset_EMSSubmission' ],
autoGenerate => 0,
);
sub _default_startDate {
return WebGUI::DateTime->new()->toMysql;
}
property duration => (
tab => "properties",
fieldType => "float",

View file

@ -123,7 +123,6 @@ sub addSubmission {
$newParams->{submissionId} = $self->ems->getNextSubmissionId;
my $newAsset = $self->addChild($newParams);
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session, { override => 1, allowComments => 0 });
$self = $self->cloneFromDb;
return $newAsset;
}

View file

@ -344,7 +344,7 @@ sub disqualifyAsLastPost {
$thread->update({ lastPostId => $secondary_post->getId, lastPostDate => $secondary_post->get('creationDate'), });
}
else {
$thread->update({ lastPostId => '', lastPostDate => '', });
$thread->update({ lastPostId => '', lastPostDate => 0 });
}
}
my $cs = $thread->getParent;
@ -359,7 +359,7 @@ sub disqualifyAsLastPost {
$cs->update({ lastPostId => $secondary_post->getId, lastPostDate => $secondary_post->get('creationDate'), });
}
else {
$cs->update({ lastPostId => '', lastPostDate => '', });
$cs->update({ lastPostId => '', lastPostDate => 0 });
}
}
}

View file

@ -45,7 +45,7 @@ property lastPostId => (
property lastPostDate => (
noFormPost => 1,
fieldType => "dateTime",
default => undef,
default => 0,
);
property karma => (
noFormPost => 1,

View file

@ -620,13 +620,13 @@ sub www_createSubscriptionCodeBatch {
name => 'name',
label => $i18n->get('batch name'),
hoverHelp => $i18n->get('batch name description'),
value => $session->form->process('name'),
value => $session->form->process('name') || '',
);
$f->addField( "textarea",
name => 'description',
label => $i18n->get('batch description'),
hoverHelp => $i18n->get('batch description description'),
value => $session->form->process("description"),
value => $session->form->process("description") || '',
);
$f->addField( "submit", name => "send" );

View file

@ -1379,7 +1379,7 @@ around groupIdView => sub {
my $oldValue = $self->$orig;
my $return = $self->$orig(@_);
# Update the subscription group so if they can't see the collab, they don't get e-mailed
if ( $newValue && $newValue != $oldValue ) {
if ( $newValue && $newValue ne $oldValue ) {
my $instance_data = {
workflowId => 'xR-_GRRbjBojgLsFx3dEMA',
className => 'WebGUI::Asset',

View file

@ -121,6 +121,7 @@ use WebGUI::Asset::Wobject::Folder;
use WebGUI::Paginator;
use WebGUI::Keyword;
use WebGUI::Search;
use WebGUI::VersionTag;
use File::Path;
@ -302,7 +303,20 @@ sub getFolder {
my $folder = eval { WebGUI::Asset->newByUrl($session, $folderUrl); };
return $folder if !Exception::Class->caught();
##The requested folder doesn't exist. Make it.
##The requested folder doesn't exist. Make it and autocommit it.
##For a fully automatic commit, save the current tag, create a new one
##with the commit without approval workflow, commit it, then restore
##the original if it exists
my ($oldVersionTag, $newVersionTag);
$oldVersionTag = WebGUI::VersionTag->getWorking($session, 'noCreate');
if ($self->hasBeenCommitted) {
$newVersionTag = WebGUI::VersionTag->create($session, { workflowId => 'pbworkflow00000000003', });
$newVersionTag->setWorking;
$newVersionTag->set({ name => 'Adding folder '. $folderName. ' to archive '. $self->getUrl});
}
##Call SUPER because my addChild calls getFolder
$folder = $self->addChild({
@ -313,6 +327,9 @@ sub getFolder {
isHidden => 1,
styleTemplateId => $self->styleTemplateId,
});
$newVersionTag->commit() if $newVersionTag;
##Restore the old one, if it exists
$oldVersionTag->setWorking() if $oldVersionTag;
##Get a new version of the asset from the db with the correct state
$folder = $folder->cloneFromDb();

View file

@ -72,18 +72,15 @@ sub copy {
my $tree = WebGUI::ProgressTree->new($session, [ $asset->getId ] );
$process->update(sub { $tree->json });
my $newAsset = $asset->duplicate({ state => "clipboard" });
# If we aren't committing, add to a tag
if ( !$args->{commit} ) {
$newAsset->update({
status => "pending",
tagId => WebGUI::VersionTag->getWorking( $session )->getId,
});
}
$newAsset->update({ title => $newAsset->getTitle . ' (copy)'});
$tree->success($asset->getId);
$process->update(sub { $tree->json });
my $tag = WebGUI::VersionTag->getWorking($session);
if ($tag->canAutoCommit) {
$tag->commit;
}
}
1;

View file

@ -4,6 +4,7 @@ use strict;
use Class::C3;
use base qw/WebGUI::AssetHelper::Copy/;
use Scalar::Util qw{ blessed };
use WebGUI::VersionTag;
=head1 LEGAL
@ -122,17 +123,16 @@ sub copyBranch {
$process->update(sub { $tree->json });
my $newAsset = $asset->duplicateBranch( $args->{childrenOnly} ? 1 : 0, 'clipboard' );
# If we aren't committing, add to a tag
if ( !$args->{commit} ) {
$newAsset->update({
status => "pending",
tagId => WebGUI::VersionTag->getWorking( $session )->getId,
});
}
$newAsset->update({ title => $newAsset->getTitle . ' (copy)'});
$tree->success($asset->getId);
$process->update(sub { $tree->json });
my $tag = WebGUI::VersionTag->getWorking($session);
if ($tag->canAutoCommit) {
$tag->commit;
}
}
1;

View file

@ -48,8 +48,6 @@ sub process {
my $import = WebGUI::Asset->getImportNode( $session );
my $tag = WebGUI::VersionTag->getWorking( $session );
my $child = $import->addChild({
tagId => $tag->getId,
status => 'pending',
className => 'WebGUI::Asset::Shortcut',
shortcutToAssetId => $asset->getId,
title => $asset->getTitle,

View file

@ -73,13 +73,6 @@ sub duplicate {
$process->update(sub { $tree->json });
my $newAsset = $asset->duplicate;
# If we aren't committing, add to a tag
if ( !$args->{commit} ) {
$newAsset->update({
status => "pending",
tagId => WebGUI::VersionTag->getWorking( $session )->getId,
});
}
$newAsset->update({ title => $newAsset->getTitle . ' (Duplicate)'});
$tree->success($asset->getId);

View file

@ -405,7 +405,7 @@ sub www_editBranchSave {
my $revision;
if (scalar %$newData > 0) {
$revision = $descendant->addRevision(
{ %$newData, tagId => $tag->getId, status => "pending" },
{ %$newData, },
undef,
{skipAutoCommitWorkflows => 1, skipNotification => 1},
);

View file

@ -157,8 +157,7 @@ sub www_cropSave {
return $session->privilege->locked() unless $asset->canEditIfLocked;
my $tag = WebGUI::VersionTag->getWorking( $session );
$asset = $asset->addRevision({ tagId => $tag->getId, status => "pending" });
$asset->setVersionLock;
$asset = $asset->addRevision();
delete $asset->{_storageLocation};
$asset->getStorageLocation->crop(
$asset->filename,
@ -171,7 +170,7 @@ sub www_cropSave {
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, { allowComments => 0 });
# We're in admin mode, close the dialog
my $helper = { message => 'Image croped', };
my $helper = { message => 'Image cropped', };
my $text = '<script type="text/javascript">';
if ( ref $helper eq 'HASH' ) {

View file

@ -146,8 +146,7 @@ sub www_resizeSave {
return $session->privilege->insufficient() unless $asset->canEdit;
return $session->privilege->locked() unless $asset->canEditIfLocked;
my $tag = WebGUI::VersionTag->getWorking($session);
$asset = $asset->addRevision( { tagId => $tag->getId, status => "pending" } );
$asset->setVersionLock;
$asset = $asset->addRevision();
delete $asset->{_storageLocation};
$asset->getStorageLocation->resize(
$asset->filename,

View file

@ -91,8 +91,7 @@ sub www_rotateSave {
return $session->privilege->locked() unless $asset->canEditIfLocked;
my $tag = WebGUI::VersionTag->getWorking( $session );
$asset = $asset->addRevision({ tagId => $tag->getId, status => "pending" });
$asset->setVersionLock;
$asset = $asset->addRevision();
delete $asset->{_storageLocation};
$asset->getStorageLocation->rotate($asset->filename,$session->form->process("Rotate"));
$asset->setSize($asset->getStorageLocation->getFileSize($asset->filename));

View file

@ -53,12 +53,7 @@ sub process {
return { error => sprintf $i18n->get('already locked'), $asset->getTitle};
}
my $tag = WebGUI::VersionTag->getWorking( $session );
$asset = $asset->addRevision({
tagId => $tag->getId,
status => "pending",
});
$asset->setVersionLock;
$asset->addRevision;
return {
message => sprintf($i18n->get('locked asset'), $asset->getTitle),
};

View file

@ -82,6 +82,31 @@ sub addRevision {
my $now = shift || time();
my $options = shift;
my $autoCommitId = $self->getAutoCommitWorkflowId() unless ($options->{skipAutoCommitWorkflows});
my ($workingTag, $oldWorking);
if ( $autoCommitId ) {
$workingTag
= WebGUI::VersionTag->create( $self->session, {
groupToUse => '12', # Turn Admin On (for lack of something better)
workflowId => $autoCommitId,
} );
}
else {
my $parentAsset;
if ( not defined( $parentAsset = $self->getParent ) ) {
$parentAsset = WebGUI::Asset->newPending( $self->session, $self->get('parentId') );
}
if ( $parentAsset->hasBeenCommitted ) {
$workingTag = WebGUI::VersionTag->getWorking( $self->session );
}
else {
$oldWorking = WebGUI::VersionTag->getWorking($self->session, 'noCreate');
$workingTag = WebGUI::VersionTag->new( $self->session, $parentAsset->get('tagId') );
$workingTag->setWorking();
}
}
#Create a dummy revision to be updated with real data later
$session->db->beginTransaction;
@ -109,7 +134,7 @@ sub addRevision {
$session->db->commit;
# current values, and the user set properties
my %mergedProperties = (%{$self->get}, %{$properties}, );
my %mergedProperties = (%{$self->get}, %{$properties}, tagId => $workingTag->getId, status => 'pending', );
# Set some defaults
$mergedProperties{ revisedBy } = $properties->{ revisedBy } || $session->user->userId;
@ -121,7 +146,10 @@ sub addRevision {
my $newVersion = WebGUI::Asset->newById($session, $self->getId, $now);
$newVersion->setSkipNotification if ($options->{skipNotification});
$newVersion->updateHistory("created revision");
$newVersion->setVersionLock;
$newVersion->update(\%mergedProperties);
$newVersion->setAutoCommitTag($workingTag) if (defined $autoCommitId);
$oldWorking->setWorking if $oldWorking;
return $newVersion;
}

View file

@ -606,7 +606,7 @@ sub sendRequestToMaster {
};
return 1 unless $@;
undef $pipe;
$self->session->log->error('Problems talking to master daemon process. Please restart the web server.');
$self->session->log->error("Problems talking to master daemon process: $@. Please restart the web server.");
return 0;
}

View file

@ -136,7 +136,7 @@ Returns the amount of credit that is owed to this user.
sub getSum {
my $self = shift;
my $credit = $self->session->db->quickScalar("select sum(amount) from shopCredit where userId=?",[$self->userId]);
my $credit = $self->session->db->quickScalar("select sum(amount) from shopCredit where userId=?",[$self->userId]) || 0;
return sprintf("%.2f", $credit);
}

View file

@ -76,44 +76,44 @@ sub execute {
# keep track of how much time it's taking
my $start = time;
my $limit = 2_500;
my $timeLimit = 60;
my $timeLimit = $self->getTTL;
my $list = $root->getLineage( ['descendants'], {
includeOnlyClasses => ['WebGUI::Asset::EMSSubmissionForm'],
returnObjects => 1,
} );
includeOnlyClasses => ['WebGUI::Asset::EMSSubmissionForm'],
returnObjects => 1,
} );
for my $emsForm ( @$list ) {
my $whereClause = q{ submissionStatus='approved' };
my $res = $emsForm->getLineage(['children'],{ returnObjects => 1,
joinClass => 'WebGUI::Asset::EMSSubmission',
includeOnlyClasses => ['WebGUI::Asset::EMSSubmission'],
whereClause => $whereClause,
returnObjects => 1,
} );
for my $submission ( @$res ) {
my $properties = { className => 'WebGUI::Asset::Sku::EMSTicket' };
my $res = $emsForm->getLineage(['children'], {
returnObjects => 1,
joinClass => 'WebGUI::Asset::EMSSubmission',
includeOnlyClasses => ['WebGUI::Asset::EMSSubmission'],
whereClause => ,q{ submissionStatus='approved' },
returnObjects => 1,
} );
for my $submission ( @$res ) {
my $properties = { className => 'WebGUI::Asset::Sku::EMSTicket' };
for my $name ( qw{title description seatsAvailable price vendorId
synopsis location duration startDate sku relatedRibbons
relatedBadgeGroups eventMetaData shipsSeparately} ) {
$properties->{$name} = $submission->get($name);
$properties->{$name} = $submission->get($name);
}
$properties->{eventNumber} = $self->session->db->quickScalar(
"select max(eventNumber)+1
from EMSTicket left join asset using (assetId)
where parentId=?",[$emsForm->ems->getId]) || 0;
"select max(eventNumber)+1 from EMSTicket left join asset using (assetId)
where parentId=?",[$emsForm->ems->getId]) || 0;
my $newAsset = $emsForm->ems->addChild( $properties );
if( $newAsset ) {
# TODO this should be addRevision
$submission->update({ ticketId => $newAsset->getId, submissionStatus => 'created' });
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, { override => 1, allowComments => 0 });
} else {
# TODO this should be addRevision
$submission->update({ ticketId => $newAsset->getId, submissionStatus => 'created' });
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, { override => 1, allowComments => 0 });
}
else {
$submission->addComment($@) if $@;
$submission->update({ submissionStatus => 'failed' });
}
$limit--;
last if ! $limit or time > $start + $timeLimit;
}
$submission->update({ submissionStatus => 'failed' });
}
$limit--;
last if ! $limit or time > $start + $timeLimit;
}
}
return $self->WAITING(1) if ! $limit or time > $start + $timeLimit;
return $self->COMPLETE;

View file

@ -141,26 +141,6 @@ $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;
note "loadModule";
{
my $className = eval { WebGUI::Asset->loadModule('Moose::Asset'); };
@ -613,8 +593,10 @@ my $node = WebGUI::Asset->getRoot($session);
my $product1 = $node->addChild({ className => 'WebGUI::Asset::Sku::Product'}, undef, undef, { skipAutoCommitWorkflows => 1});
my $product2 = $node->addChild({ className => 'WebGUI::Asset::Sku::Product'}, undef, undef, { skipAutoCommitWorkflows => 1});
my $product3 = $node->addChild({ className => 'WebGUI::Asset::Sku::Product'}, undef, undef, { skipAutoCommitWorkflows => 1});
WebGUI::Test->addToCleanup($product1, $product2, $product3);
my $product4 = $node->addChild({ className => 'WebGUI::Asset::Sku::Product', status => "pending"}, undef, undef, { skipAutoCommitWorkflows => 1});
my $ptag = WebGUI::VersionTag->getWorking($session);
$ptag->commit;
WebGUI::Test->addToCleanup($product1, $product2, $product3, $ptag);
my $product4 = $node->addChild({ className => 'WebGUI::Asset::Sku::Product'}, undef, undef, { skipAutoCommitWorkflows => 1});
WebGUI::Test->addToCleanup($product4);
my $getAProduct = WebGUI::Asset::Sku::Product->getIsa($session);
@ -738,8 +720,6 @@ my $cloneTag = WebGUI::VersionTag->getWorking($session);
my $assetToCommit = $defaultAsset->addChild({
className => 'WebGUI::Asset::Snippet',
title => 'Snippet to commit and clone from db',
status => "pending",
tagId => $cloneTag->getId,
});
WebGUI::Test->addToCleanup($cloneTag);
$cloneTag->commit;

View file

@ -28,7 +28,6 @@ my $session = WebGUI::Test->session;
$session->user({userId => 3});
my $root = WebGUI::Asset->getRoot($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
my %tag = ( tagId => $versionTag->getId, status => "pending" );
$versionTag->set({name=>"Asset Clipboard test"});
WebGUI::Test->addToCleanup($versionTag);
@ -38,7 +37,6 @@ my $snippet = $root->addChild({
menuTitle => 'snippetMenuTitle',
className => 'WebGUI::Asset::Snippet',
snippet => 'A snippet of text',
%tag,
}, undef, time()-3);
my $snippetAssetId = $snippet->getId;
@ -49,28 +47,24 @@ my $topFolder = $root->addChild({
menuTitle => 'topFolderMenuTitle',
groupIdEdit => 3,
className => 'WebGUI::Asset::Wobject::Folder',
%tag,
});
my $folder1a = $topFolder->addChild({
url => 'folder_1a',
title => 'folder1a',
groupIdEdit => 3,
className => 'WebGUI::Asset::Wobject::Folder',
%tag,
});
my $folder1b = $topFolder->addChild({
url => 'folder_1b',
title => 'folder1b',
groupIdEdit => 3,
className => 'WebGUI::Asset::Wobject::Folder',
%tag,
});
my $folder1a2 = $folder1a->addChild({
url => 'folder_1a2',
title => 'folder1a2',
groupIdEdit => 3,
className => 'WebGUI::Asset::Wobject::Folder',
%tag,
});
@ -147,15 +141,11 @@ my $tempspace = WebGUI::Test->asset;
my $page = $tempspace->addChild({
className => 'WebGUI::Asset::Wobject::Layout',
title => 'Parent asset',
tagId => $versionTag2->getId,
status => "pending",
});
my $shortcut = $tempspace->addChild({
className => 'WebGUI::Asset::Shortcut',
shortcutToAssetId => $page->getId,
tagId => $versionTag2->getId,
status => "pending",
});
$versionTag2->commit;
@ -187,6 +177,8 @@ $process->mock( "session" => sub { return $session } );
# Try with a Collaboration and some Threads
my $tag = WebGUI::VersionTag->getWorking( $session );
WebGUI::Test->addToCleanup($tag);
my $collab = WebGUI::Test->asset(
className => 'WebGUI::Asset::Wobject::Collaboration',
groupIdEdit => "3",
@ -194,7 +186,10 @@ my $collab = WebGUI::Test->asset(
my $thread = $collab->addChild({
className => 'WebGUI::Asset::Post::Thread',
groupIdEdit => "3",
}, undef, undef, { skipNotification => 1 });
}, undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1, },
);
$tag->commit;
$thread = $thread->cloneFromDb; ##so that the cached parent asset with the wrong status does not update the db.
$thread->cut;
WebGUI::Asset::pasteInFork( $process, { assetId => $collab->getId, list => [ $thread->getId ] } );
$thread = $thread->cloneFromDb;

View file

@ -191,22 +191,16 @@ my $parent = $importNode->addChild({
className => 'WebGUI::Asset::Wobject::Layout',
styleTemplateId => 'PBtmpl0000000000000132',
url => 'parent',
tagId => $versionTag->getId,
status => "pending",
});
my $firstChild = $parent->addChild({
className => 'WebGUI::Asset::Wobject::Layout',
styleTemplateId => 'PBtmpl0000000000000132',
url => 'first_child',
tagId => $versionTag->getId,
status => "pending",
});
my $grandChild = $firstChild->addChild({
className => 'WebGUI::Asset::Wobject::Article',
styleTemplateId => 'PBtmpl0000000000000132',
url => 'first_child/grand_child',
tagId => $versionTag->getId,
status => "pending",
});
$versionTag->commit;
@ -337,8 +331,6 @@ my $asset = $importNode->addChild($properties, $properties->{id});
$asset->update({
storageId => $storage->getId,
filename => $filename,
tagId => $versionTag->getId,
status => "pending",
});
my $fileAsPath = $asset->exportGetUrlAsPath('index.html');
@ -358,8 +350,6 @@ $properties = {
title => 'Export Test',
className => 'WebGUI::Asset::File',
url => 'export-test.foobar',
tagId => $versionTag->getId,
status => "pending",
};
$asset = $importNode->addChild($properties, $properties->{id});
$asset->update({

View file

@ -40,8 +40,6 @@ my $topFolder = $root->addChild({
menuTitle => 'topFolderMenuTitle',
groupIdEdit => 3,
className => 'WebGUI::Asset::Wobject::Folder',
tagId => $versionTag->getId,
status => "pending",
});
my $folder = $topFolder->addChild({
@ -50,8 +48,6 @@ my $folder = $topFolder->addChild({
menuTitle => 'folderMenuTitle',
groupIdEdit => 3,
className => 'WebGUI::Asset::Wobject::Folder',
tagId => $versionTag->getId,
status => "pending",
});
my $folder2 = $topFolder->addChild({
@ -59,8 +55,6 @@ my $folder2 = $topFolder->addChild({
title => 'folder2',
menuTitle => 'folder2MenuTitle',
className => 'WebGUI::Asset::Wobject::Folder',
tagId => $versionTag->getId,
status => "pending",
});
my $editor = WebGUI::User->new($session, 'new');
@ -77,8 +71,6 @@ foreach my $snipNum (0..6) {
title => "Snippet $snipNum",
menuTitle => $snipNum,
url => 'snippet'.$snipNum,
tagId => $versionTag->getId,
status => "pending",
});
}
@ -88,8 +80,6 @@ my $snippet2 = $folder2->addChild( {
ownerUserId => $editor->userId, #For coverage on addChild properties
title => "Snippet2 0",
menuTitle => 0,
tagId => $versionTag->getId,
status => "pending",
});
$versionTag->commit;
@ -681,8 +671,6 @@ WebGUI::Test->interceptLogging( sub {
ownerUserId => 3, #For coverage on addChild properties
title => "Deep Snippet $_",
menuTitle => "Deep Snip $_",
tagId => $vTag2->getId,
status => "pending",
});
}

View file

@ -28,7 +28,6 @@ my $session = WebGUI::Test->session;
$session->user({userId => 3});
my $root = WebGUI::Test->asset;
my $versionTag = WebGUI::VersionTag->getWorking($session);
my %tag = ( tagId => $versionTag->getId, status => "pending" );
$versionTag->set({name=>"Asset Package test"});
WebGUI::Test->addToCleanup($versionTag);
@ -44,7 +43,6 @@ my $folder = $root->addChild({
menuTitle => 'folderMenuTitle',
className => 'WebGUI::Asset::Wobject::Folder',
isPackage => 1,
%tag,
});
my $snippet = $folder->addChild({
@ -53,7 +51,6 @@ my $snippet = $folder->addChild({
menuTitle => 'snippetMenuTitle',
className => 'WebGUI::Asset::Snippet',
snippet => 'A snippet of text',
%tag,
});
$versionTag->commit;

View file

@ -40,8 +40,6 @@ my $folder = $root->addChild({
menuTitle => 'folderMenuTitle',
className => 'WebGUI::Asset::Wobject::Folder',
isPackage => 1,
tagId => $versionTag->getId,
status => "pending",
}, undef, $time);
my $targetFolder = $root->addChild({
@ -49,8 +47,6 @@ my $targetFolder = $root->addChild({
title => 'Target Folder',
menuTitle => 'Target folderMenuTitle',
className => 'WebGUI::Asset::Wobject::Folder',
tagId => $versionTag->getId,
status => "pending",
});
my $subSnippet = $folder->addChild({
@ -59,8 +55,6 @@ my $subSnippet = $folder->addChild({
menuTitle => 'snippetMenuTitle',
className => 'WebGUI::Asset::Snippet',
snippet => 'A snippet of text',
tagId => $versionTag->getId,
status => "pending",
}, undef, $time);
my $snippet = $root->addChild({
@ -69,8 +63,6 @@ my $snippet = $root->addChild({
className => 'WebGUI::Asset::Snippet',
snippet => 'Always upgrade to the latest version',
isPackage => 1,
tagId => $versionTag->getId,
status => "pending",
}, undef, $time);
my $packageAssetId = $folder->getId;
@ -90,8 +82,6 @@ isa_ok($storage, 'WebGUI::Storage', 'exportPackage returns a WebGUI::Storage obj
my $vt2 = WebGUI::VersionTag->getWorking($session);
my $snippetRev = $snippet->addRevision({
snippet => 'Only upgrade existing data if revisionDate is newer',
tagId => $vt2->getId,
status => "pending",
});
is($snippetRev->get('snippet'), 'Only upgrade existing data if revisionDate is newer', 'importPackage, overwriteLatest: precondition check, content');
cmp_ok( $snippetRev->get('revisionDate'), '>', $snippet->get('revisionDate'), '... precondition check, revisionDate');
@ -117,7 +107,7 @@ isa_ok($deployedFolderChildren->[0] , 'WebGUI::Asset::Snippet', 'deployed child
##Unset isPackage in this versionTag for the next tests
my $newVersionTag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($newVersionTag);
$folder->addRevision({isPackage => 0, tagId => $newVersionTag->getId, status => "pending", });
$folder->addRevision({isPackage => 0, });
$newVersionTag->commit;
my $newFolder = WebGUI::Asset->newById($session, $folder->getId);
@ -148,8 +138,6 @@ WebGUI::Test->addToCleanup($lastTag);
className => 'WebGUI::Asset::Snippet',
snippet => 'This is a test asset',
isPackage => 1,
tagId => $flagTag->getId,
status => "pending",
}
);
my $storage = $snippet->exportPackage;

View file

@ -35,7 +35,6 @@ my $root = WebGUI::Asset->getRoot($session);
my $originalVersionTags = $session->db->quickScalar(q{select count(*) from assetVersionTag});
my $tag = WebGUI::VersionTag->getWorking( $session );
WebGUI::Test->addToCleanup($tag);
my %tag = ( tagId => $tag->getId, status => "pending" );
################################################################
#
@ -44,13 +43,13 @@ my %tag = ( tagId => $tag->getId, status => "pending" );
################################################################
note "purgeRevision tests";
my $snippet = $root->addChild({%propertyHash,%tag});
my $snippet = $root->addChild({%propertyHash,});
$snippet->commit;
isa_ok $snippet, "WebGUI::Asset::Snippet";
checkTableEntries($snippet->getId, 1,1,1,1);
my $snippetv2 = $snippet->addRevision({snippet => 'Hello, I am a snippet with formal grammar',%tag},time+1);
my $snippetv2 = $snippet->addRevision({snippet => 'Hello, I am a snippet with formal grammar',},time+1);
$snippetv2->commit;
is ($snippetv2->getId, $snippet->getId, 'Both versions of the asset have the same assetId');
@ -62,7 +61,7 @@ checkTableEntries($snippetv2->getId, 1,1,1,1);
undef $snippetv2;
my $snippetv2a = $snippet->addRevision({snippet => 'Hey, yall! Ima snippet.',%tag},time+2);
my $snippetv2a = $snippet->addRevision({snippet => 'Hey, yall! Ima snippet.',},time+2);
$snippetv2a->commit;
$snippet->purgeRevision;
@ -82,12 +81,14 @@ is($versionTagCheck, $originalVersionTags, 'version tag cleaned up by deleting l
#
################################################################
$snippet = $root->addChild({%propertyHash,%tag});
$tag->commit;
$snippet = $root->addChild({%propertyHash,});
my $tag1 = WebGUI::VersionTag->getWorking($session);
$tag1->commit;
WebGUI::Test->addToCleanup($tag1);
my $snippet = $snippet->cloneFromDb;
my $tag2 = WebGUI::VersionTag->getWorking($session);
$tag{tagId} = $tag2->getId;
WebGUI::Test->addToCleanup($tag2);
$snippetv2 = $snippet->addRevision({snippet => 'Vie gates. Ich bin ein snippetr.',%tag}, time+3);
$snippetv2 = $snippet->addRevision({snippet => 'Vie gates. Ich bin ein snippetr.',}, time+3);
$tag2->commit;
note "purge";
checkTableEntries($snippetv2->getId, 1,2,2);

View file

@ -86,7 +86,9 @@ my $ems = $node->addChild({
groupIdView => $attendees->getId,
submittedLocationsList => join( "\n", my @submissionLocations = qw'loc1 loc2' ),
});
WebGUI::Test->addToCleanup($ems);
my $ems_tag = WebGUI::VersionTag->getWorking($session);
$ems_tag->commit;
WebGUI::Test->addToCleanup($ems, $ems_tag);
# I scooped this out ot WG::Asset::Wobject::EventManagementSystem
# its not pretty, but there is no other way to add a meta field
my $mf1Id = $ems->setCollateral("EMSEventMetaField", "fieldId",{
@ -197,7 +199,7 @@ my $submission = {
title => 'my favorite thing to talk about',
description => 'the description',
startDate => '1255150800',
};
};
$session->request->setup_body($submission);
my $sub1 = $frmA->addSubmission;
WebGUI::Test->addToCleanup( $sub1 );
@ -215,7 +217,7 @@ $submission = {
title => 'why i like to be important',
description => 'the description',
mfRequiredUrl => 'http://google.com',
};
};
$session->request->setup_body($submission);
my $sub2 = $frmB->addSubmission;
WebGUI::Test->addToCleanup( $sub2 );
@ -326,6 +328,8 @@ is($sub1->get('submissionStatus'),'approved','set status to approved');
$sub2->update({ submissionStatus => 'denied' });
is($sub2->get('submissionStatus'),'denied','set status to denied');
diag $sub1->submissionStatus;
diag $sub1->ticketId;
SKIP: { skip "workflow activities not coded yet", 10 if 0;
@ -341,13 +345,18 @@ is($approveSubmissions->run, 'complete', 'approval complete');
is($approveSubmissions->run, 'done', 'approval done');
$sub1 = $sub1->cloneFromDb;
diag $sub1->submissionStatus;
diag $sub1->ticketId;
diag $sub1->getRevisionCount;
is( $sub1->get('submissionStatus'),'created','approval successfull');
my $ticket = WebGUI::Asset->newById($session, $sub1->get('ticketId'));
WebGUI::Test->addToCleanup( $ticket ) if $ticket ;
my $ticket = eval { WebGUI::Asset->newById($session, $sub1->get('ticketId')); };
my $e = Exception::Class->caught();
SKIP: {
skip 'no ticket created', 1 unless isa_ok( $ticket, 'WebGUI::Asset::Sku::EMSTicket', 'approval created a ticket');
is( $ticket->get('title'), $sub1->get('title'), 'Ticket title matches submission title' );
skip 'no ticket created', 2 if $e;
isa_ok( $ticket, 'WebGUI::Asset::Sku::EMSTicket', 'approval created a ticket');
WebGUI::Test->addToCleanup( $ticket ) if $ticket ;
is( $ticket->get('title'), $sub1->get('title'), 'Ticket title matches submission title' );
}
my $newDate = time - ( 60 * 60 * 24 * ( $sub2->getParent->get('daysBeforeCleanup') + 1 ) ),

View file

@ -29,8 +29,6 @@ WebGUI::Test->addToCleanup($versionTag);
my $defaultAsset = WebGUI::Asset->getDefault($session);
my $cal = $defaultAsset->addChild({
className=>'WebGUI::Asset::Wobject::Calendar',
tagId => $versionTag->getId,
status => "pending",
});
$versionTag->commit;
@ -49,8 +47,6 @@ my $properties = {
endTime => '03:00:00',
timeZone => 'America/Chicago',
location => 'Madison, Wisconsin',
tagId => $versionTag->getId,
status => "pending",
};
my $event = $cal->addChild($properties, $properties->{id});

View file

@ -40,8 +40,6 @@ my $calendar = $node->addChild({
groupIdView => '7', # Everyone
groupIdEdit => '3', # Admins
groupIdEventEdit => '2', # Registered Users
tagId => $versionTags[-1]->getId,
status => "pending",
});
$versionTags[-1]->commit;
@ -64,8 +62,6 @@ WebGUI::Test->addToCleanup($versionTags[-1]);
$event = $calendar->addChild({
className => 'WebGUI::Asset::Event',
ownerUserId => 3,
tagId => $versionTags[-1]->getId,
status => "pending",
}, @addArgs);
$maker->prepare( {

View file

@ -53,8 +53,6 @@ my $properties = {
title => 'File Asset Test',
className => 'WebGUI::Asset::File',
url => 'file-asset-test',
tagId => $versionTag->getId,
status => "pending",
};
my $defaultAsset = WebGUI::Asset->getDefault($session);
my $asset = $defaultAsset->addChild($properties, $properties->{id});

View file

@ -26,12 +26,10 @@ my $versionTag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($versionTag);
$versionTag->set({name=>"Photo Test"});
my %tag = ( tagId => $versionTag->getId, status => "pending" );
my $gallery
= $node->addChild({
className => "WebGUI::Asset::Wobject::Gallery",
%tag,
},
undef,
undef,
@ -41,7 +39,6 @@ my $gallery
my $album
= $gallery->addChild({
className => "WebGUI::Asset::Wobject::GalleryAlbum",
%tag,
},
undef,
undef,
@ -64,7 +61,6 @@ use_ok("WebGUI::Asset::File::GalleryFile::Photo");
$photo
= $album->addChild({
className => "WebGUI::Asset::File::GalleryFile::Photo",
%tag,
},
undef,
undef,

View file

@ -31,7 +31,6 @@ my $versionTag = WebGUI::VersionTag->getWorking($session);
# Name version tag and make sure it gets cleaned up
$versionTag->set({name=>"Orientation adjustment test"});
my %tag = ( tagId => $versionTag->getId, status => "pending" );
WebGUI::Test->addToCleanup($versionTag);
# Create gallery and a single album
@ -39,7 +38,6 @@ my $gallery
= $node->addChild({
className => "WebGUI::Asset::Wobject::Gallery",
imageResolutions => "1024",
%tag,
},
undef,
undef,
@ -49,7 +47,6 @@ my $gallery
my $album
= $gallery->addChild({
className => "WebGUI::Asset::Wobject::GalleryAlbum",
%tag,
},
undef,
undef,
@ -61,7 +58,6 @@ my $album
my $photo
= $album->addChild({
className => "WebGUI::Asset::File::GalleryFile::Photo",
%tag,
},
undef,
undef,

View file

@ -26,16 +26,13 @@ my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($versionTag);
$versionTag->set({name=>"Photo Test"});
my %tag = ( tagId => $versionTag->getId, status => "pending" );
my $gallery
= $node->addChild({
className => "WebGUI::Asset::Wobject::Gallery",
%tag,
});
my $album
= $gallery->addChild({
className => "WebGUI::Asset::Wobject::GalleryAlbum",
%tag,
},
undef, undef,
{ skipAutoCommitWorkflows => 1 },
@ -43,7 +40,6 @@ my $album
my $photo
= $album->addChild({
className => "WebGUI::Asset::File::GalleryFile::Photo",
%tag,
},
undef, undef,
{ skipAutoCommitWorkflows => 1 },

View file

@ -15,6 +15,7 @@ use strict;
use WebGUI::Test;
use WebGUI::Session;
use Test::More;
use WebGUI::VersionTag;
#----------------------------------------------------------------------------
# Init
@ -22,6 +23,7 @@ my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
# Create gallery and a single album
my $tag = WebGUI::VersionTag->getWorking($session);
my $gallery
= WebGUI::Test->asset(
className => "WebGUI::Asset::Wobject::Gallery",
@ -41,15 +43,15 @@ for (my $i = 0; $i < 5; $i++)
className => "WebGUI::Asset::File::GalleryFile::Photo",
});
}
$tag->commit;
WebGUI::Test->addToCleanup($tag);
foreach my $asset ($gallery, $album, @photo) {
$asset = $asset->cloneFromDb;
}
#----------------------------------------------------------------------------
# Tests
plan tests => 11;
#----------------------------------------------------------------------------
# Test module compiles okay
# plan tests => 1
use_ok("WebGUI::Asset::File::GalleryFile::Photo");
#----------------------------------------------------------------------------
# Test getFirstFile method
@ -81,3 +83,4 @@ is( $photo[2]->getNextFile->getId, $photo[3]->getId, 'Photo next of photo no. 3
is( $photo[3]->getNextFile->getId, $photo[4]->getId, 'Photo next of photo no. 4 is photo no. 5' );
is( $photo[4]->getNextFile, undef, 'Photo next of photo no. 5 is undef' );
done_testing;

View file

@ -15,6 +15,7 @@ use strict;
use WebGUI::Test;
use WebGUI::HTML;
use WebGUI::Session;
use WebGUI::VersionTag;
use Test::More;
use Test::Deep;
use WebGUI::Asset::File::GalleryFile::Photo;
@ -24,6 +25,8 @@ use WebGUI::Asset::File::GalleryFile::Photo;
my $session = WebGUI::Test->session;
my $user = WebGUI::User->new( $session, 3 );
my $tag = WebGUI::VersionTag->getWorking($session);
my $gallery
= WebGUI::Test->asset(
className => "WebGUI::Asset::Wobject::Gallery",
@ -56,6 +59,12 @@ my $nextPhoto
$photo->setFile( WebGUI::Test->getTestCollateralPath('page_title.jpg') );
$tag->commit;
WebGUI::Test->addToCleanup($tag);
foreach my $asset ($gallery, $album, $previousPhoto, $photo, $nextPhoto) {
$asset = $asset->cloneFromDb;
}
#----------------------------------------------------------------------------
# Tests
plan tests => 1;

View file

@ -28,13 +28,11 @@ $versionTag->set({name=>"Collab setup"});
WebGUI::Test->addToCleanup($versionTag);
# Need to create a Collaboration system in which the post lives.
my @addArgs = ( undef, undef, { skipNotification => 1 } );
my @addArgs = ( undef, undef, { skipNotification => 1, skipAutoCommitWorkflows => 1 } );
my $collab = $node->addChild({
className => 'WebGUI::Asset::Wobject::Collaboration',
editTimeout => '1',
threadsPerPage => 3,
status => "pending",
tagId => $versionTag->getId,
},
@addArgs);
@ -44,8 +42,6 @@ my $props = {
className => 'WebGUI::Asset::Post::Thread',
content => 'hello, world!',
ownerUserId => 1,
status => "pending",
tagId => $versionTag->getId,
};
my $thread = $collab->addChild($props, @addArgs);
@ -79,13 +75,16 @@ my @newThreads;
my $threadCount = 15;
my $versionTag2 = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup( $versionTag2 );
$props->{tagId} = $versionTag2->getId;
while ($threadCount--) {
push @newThreads, $collab->addChild($props, @addArgs);
}
$_->setSkipNotification for @newThreads;
$versionTag2->commit;
foreach my $asset (@newThreads) {
$asset = $asset->cloneFromDb;
}
my $csUrl = $collab->get('url');
like $newThreads[-1]->getCSLinkUrl, qr/^$csUrl/, 'getCsLinkUrl returns URL of the parent CS with no gateway';
like $newThreads[-1]->getCSLinkUrl, qr/\?pn=1/, '... and has the right page number';

View file

@ -136,8 +136,6 @@ push @threads, $collab->addChild( {
title => "Abababa",
isSticky => 0,
threadRating => 1_000_000,
tagId => $versionTags[-1]->getId,
status => "pending",
}, undef, 6, @addChildArgs
);
$sort = sub { $b->get('revisionDate') <=> $a->get('revisionDate') };

View file

@ -48,8 +48,6 @@ my $collab
canStartThreadGroupId => 3, # Admin
allowReplies => 1,
editTimeout => 60 * 60 * 24, # 24 hours
tagId => $versionTag->getId,
status => "pending",
}, @addArgs );
my $thread
@ -57,8 +55,6 @@ my $thread
className => 'WebGUI::Asset::Post::Thread',
ownerUserId => $user{"2"}->userId,
groupIdView => 7,
tagId => $versionTag->getId,
status => "pending",
}, @addArgs );
$thread->setSkipNotification;

View file

@ -27,55 +27,61 @@ 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 $addArgs = { skipAutoCommitWorkflows => 1, skipNotification => 1 };
my $collab = $node->addChild({className => 'WebGUI::Asset::Wobject::Collaboration', %tag }, @addArgs);
my $collab = $node->addChild({className => 'WebGUI::Asset::Wobject::Collaboration', });
# finally, add posts and threads to the collaboration system
my $first_thread = $collab->addChild(
{ className => 'WebGUI::Asset::Post::Thread', %tag },
{ className => 'WebGUI::Asset::Post::Thread', },
undef,
WebGUI::Test->webguiBirthday,
$addArgs,
);
$first_thread->setSkipNotification;
my $second_thread = $collab->addChild(
{ className => 'WebGUI::Asset::Post::Thread', %tag },
{ className => 'WebGUI::Asset::Post::Thread', },
undef,
WebGUI::Test->webguiBirthday,
$addArgs,
);
$second_thread->setSkipNotification;
##Thread 1, Post 1 => t1p1
my $t1p1 = $first_thread->addChild(
{ className => 'WebGUI::Asset::Post', %tag },
{ className => 'WebGUI::Asset::Post', },
undef,
WebGUI::Test->webguiBirthday,
$addArgs,
);
$t1p1->setSkipNotification;
my $t1p2 = $first_thread->addChild(
{ className => 'WebGUI::Asset::Post', %tag },
{ className => 'WebGUI::Asset::Post', },
undef,
WebGUI::Test->webguiBirthday + 1,
$addArgs
);
$t1p2->setSkipNotification;
my $past = time()-15;
my $t2p1 = $second_thread->addChild(
{ className => 'WebGUI::Asset::Post', %tag },
{ className => 'WebGUI::Asset::Post', },
undef,
$past,
$addArgs,
);
$t2p1->setSkipNotification;
my $t2p2 = $second_thread->addChild(
{ className => 'WebGUI::Asset::Post', %tag },
{ className => 'WebGUI::Asset::Post', },
undef, undef,
$addArgs,
);
$t2p2->setSkipNotification;

View file

@ -26,13 +26,12 @@ 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" );
my $addArgs = { skipAutoCommitWorkflows => 1, skipNotification => 1 };
my $collab = $node->addChild(
{
className => 'WebGUI::Asset::Wobject::Collaboration',
title => 'Test Collaboration',
%tag,
},
);
@ -42,8 +41,8 @@ my $first_thread = $collab->addChild(
{
className => 'WebGUI::Asset::Post::Thread',
title => 'Test Thread',
%tag,
},
undef, undef, $addArgs,
);
$first_thread->setSkipNotification;
@ -52,8 +51,8 @@ my $t1p1 = $first_thread->addChild(
{
className => 'WebGUI::Asset::Post',
title => 'Test Post',
%tag,
},
undef, undef, $addArgs,
);
$t1p1->setSkipNotification;

View file

@ -28,7 +28,6 @@ my $session = WebGUI::Test->session;
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Collab setup"});
WebGUI::Test->addToCleanup($versionTag);
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 } );
@ -37,18 +36,16 @@ my $notification_template = WebGUI::Test->asset(
className => 'WebGUI::Asset::Template',
template => "<body>!!!url:<tmpl_var url>!!!content:<tmpl_var content>!!!</body>",
parser => 'WebGUI::Asset::Template::HTMLTemplate',
%tag,
);
my $collab = WebGUI::Test->asset(
className => 'WebGUI::Asset::Wobject::Collaboration',
notificationTemplateId => $notification_template->getId,
%tag,
);
# finally, add posts and threads to the collaboration system
my $first_thread = $collab->addChild( { className => 'WebGUI::Asset::Post::Thread', %tag },);
my $first_thread = $collab->addChild( { className => 'WebGUI::Asset::Post::Thread', }, @addArgs);
$first_thread->setSkipNotification;
##Thread 1, Post 1 => t1p1
@ -62,8 +59,8 @@ my $t1p1 = $first_thread->addChild(
title => $title,
url => lc $title,
content => $content,
%tag,
},
@addArgs
);
$t1p1->setSkipNotification;

View file

@ -33,7 +33,6 @@ $user{"2"}->addToGroups( ['2'] ); # Registered user
my $versionTag = WebGUI::VersionTag->getWorking( $session );
$versionTag->set( { name => "Collaboration Test" } );
my %tag = ( tagId => $versionTag->getId, status => "pending" );
WebGUI::Test->addToCleanup($versionTag);
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1 } );
@ -49,14 +48,12 @@ my $collab
canStartThreadGroupId => 3, # Admin
allowReplies => 1,
editTimeout => 60 * 60 * 24, # 24 hours
%tag,
}, @addArgs );
my $thread
= $collab->addChild({
className => 'WebGUI::Asset::Post::Thread',
ownerUserId => $user{"2"}->userId,
%tag,
}, @addArgs );
$thread->setSkipNotification;
@ -64,7 +61,6 @@ my $post
= $thread->addChild({
className => 'WebGUI::Asset::Post',
ownerUserId => $user{"2"}->userId,
%tag,
}, @addArgs );
$post->setSkipNotification;

View file

@ -27,50 +27,56 @@ 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 $addArgs = { skipAutoCommitWorkflows => 1, skipNotification => 1 };
my $collab = $node->addChild({className => 'WebGUI::Asset::Wobject::Collaboration', %tag }, );
my $collab = $node->addChild({className => 'WebGUI::Asset::Wobject::Collaboration', }, );
# finally, add posts and threads to the collaboration system
my $first_thread = $collab->addChild(
{ className => 'WebGUI::Asset::Post::Thread', %tag },
{ className => 'WebGUI::Asset::Post::Thread', },
undef,
WebGUI::Test->webguiBirthday,
$addArgs,
);
my $second_thread = $collab->addChild(
{ className => 'WebGUI::Asset::Post::Thread', %tag },
{ className => 'WebGUI::Asset::Post::Thread', },
undef,
WebGUI::Test->webguiBirthday,
$addArgs,
);
##Thread 1, Post 1 => t1p1
my $t1p1 = $first_thread->addChild(
{ className => 'WebGUI::Asset::Post', %tag },
{ className => 'WebGUI::Asset::Post', },
undef,
WebGUI::Test->webguiBirthday,
$addArgs,
);
my $t1p2 = $first_thread->addChild(
{ className => 'WebGUI::Asset::Post', %tag },
{ className => 'WebGUI::Asset::Post', },
undef,
WebGUI::Test->webguiBirthday + 1,
$addArgs,
);
my $past = time()-15;
my $t2p1 = $second_thread->addChild(
{ className => 'WebGUI::Asset::Post', %tag },
{ className => 'WebGUI::Asset::Post', },
undef,
$past,
$addArgs,
);
my $t2p2 = $second_thread->addChild(
{ className => 'WebGUI::Asset::Post', %tag },
{ className => 'WebGUI::Asset::Post', },
undef, undef,
$addArgs,
);
foreach my $asset ($t1p1, $t1p2, $t2p1, $t2p2, $first_thread, $second_thread, ) {

View file

@ -26,6 +26,7 @@ use WebGUI::Test::Mechanize;
my $session = WebGUI::Test->session;
$session->user({ userId => 3 });
my $tag = WebGUI::VersionTag->getWorking($session);
my $page = WebGUI::Test->asset( className => 'WebGUI::Asset::Wobject::Dashboard' );
my $asset = WebGUI::Test->asset(
className => 'WebGUI::Asset::Wobject::Article',
@ -36,7 +37,11 @@ my $shortcut = $page->addChild( {
shortcutToAssetId => $asset->getId,
prefFieldsToShow => 'alias',
} );
WebGUI::Test->addToCleanup($tag);
$tag->commit;
foreach my $object ($page, $asset, $shortcut) {
$object = $object->cloneFromDb;
}
#----------------------------------------------------------------------------
# Tests

View file

@ -25,6 +25,7 @@ use WebGUI::Session;
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
my $tag = WebGUI::VersionTag->getWorking($session);
my $ems = WebGUI::Test->asset( className => 'WebGUI::Asset::Wobject::EventManagementSystem' );
my $badge = $ems->addChild({
className => 'WebGUI::Asset::Sku::EMSBadge',
@ -32,6 +33,8 @@ my $badge = $ems->addChild({
my $ribbon = $ems->addChild({
className => 'WebGUI::Asset::Sku::EMSRibbon',
});
$tag->commit;
WebGUI::Test->addToCleanup($tag);
#----------------------------------------------------------------------------
# Tests

View file

@ -25,6 +25,7 @@ use WebGUI::Session;
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
my $tag = WebGUI::VersionTag->getWorking($session);
my $ems = WebGUI::Test->asset( className => 'WebGUI::Asset::Wobject::EventManagementSystem' );
my $badge = $ems->addChild({
className => 'WebGUI::Asset::Sku::EMSBadge',
@ -32,6 +33,8 @@ my $badge = $ems->addChild({
my $ticket = $ems->addChild({
className => 'WebGUI::Asset::Sku::EMSTicket',
});
$tag->commit;
WebGUI::Test->addToCleanup($tag);
#----------------------------------------------------------------------------
# Tests

View file

@ -25,6 +25,7 @@ use WebGUI::Session;
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
my $tag = WebGUI::VersionTag->getWorking($session);
my $ems = WebGUI::Test->asset( className => 'WebGUI::Asset::Wobject::EventManagementSystem' );
my $badge = $ems->addChild({
className => 'WebGUI::Asset::Sku::EMSBadge',
@ -32,6 +33,8 @@ my $badge = $ems->addChild({
my $token = $ems->addChild({
className => 'WebGUI::Asset::Sku::EMSToken',
});
$tag->commit;
WebGUI::Test->addToCleanup($tag);
#----------------------------------------------------------------------------
# Tests

View file

@ -32,21 +32,19 @@ use JSON;
# Init
my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
plan tests => 67; # Increment this number for each test you create
#----------------------------------------------------------------------------
# put your tests here
my $node = WebGUI::Asset->getRoot($session);
my $tag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($tag);
my $product = WebGUI::Test->asset(
className => "WebGUI::Asset::Sku::Product",
title => "Rock Hammer",
groupIdEdit => 3,
);
$tag->commit;
$product = $product->cloneFromDb;
is($product->getThumbnailUrl(), '', 'Product with no image1 property returns the empty string');
@ -61,6 +59,8 @@ WebGUI::Test->addToCleanup($image);
$image->addFileFromFilesystem(WebGUI::Test->getTestCollateralPath('lamp.jpg'));
$image->generateThumbnail('lamp.jpg');
my $imageTag = WebGUI::VersionTag->getWorking($session);
my $imagedProduct = WebGUI::Test->asset(
className => "WebGUI::Asset::Sku::Product",
title => "Bible",
@ -68,6 +68,9 @@ my $imagedProduct = WebGUI::Test->asset(
isShippingRequired => 1,
);
$imageTag->commit;
$imagedProduct = $imagedProduct->cloneFromDb;
ok($imagedProduct->getThumbnailUrl(), 'getThumbnailUrl is not empty');
is($imagedProduct->getThumbnailUrl(), $image->getThumbnailUrl('lamp.jpg'), 'getThumbnailUrl returns the right path to the URL');
@ -151,6 +154,7 @@ my $jsonTemplate = WebGUI::Test->asset(
my @storages = map { WebGUI::Storage->create($session) } 0..2;
my $viewTag = WebGUI::VersionTag->getWorking($session);
my $viewProduct = WebGUI::Test->asset(
className => 'WebGUI::Asset::Sku::Product',
title => 'View Product for template variable tests',
@ -159,6 +163,9 @@ my $viewProduct = WebGUI::Test->asset(
warranty => $storages[1]->getId,
manual => $storages[2]->getId,
);
$viewTag->commit;
WebGUI::Test->addToCleanup($viewTag);
$viewProduct = $viewProduct->cloneFromDb;
$viewProduct->prepareView();
my $json = $viewProduct->view();
@ -195,6 +202,7 @@ $product = $product->cloneFromDb;
cmp_deeply(
$product->getAllCollateral( 'accessoryJSON' ),
[ { accessoryAssetId => $imagedProduct->getId } ],
'accessory updated'
);
$mech->submit_form_ok({
@ -208,6 +216,7 @@ $product = $product->cloneFromDb;
cmp_deeply(
$product->getAllCollateral( 'accessoryJSON' ),
[ { accessoryAssetId => $imagedProduct->getId }, { accessoryAssetId => $viewProduct->getId } ],
'accessory edited'
);
#----------------------------------------------------------------------------
@ -228,6 +237,7 @@ $product = $product->cloneFromDb;
cmp_deeply(
$product->getAllCollateral( 'relatedJSON' ),
[ { relatedAssetId => $imagedProduct->getId } ],
'added related asset'
);
$mech->submit_form_ok({
@ -241,6 +251,7 @@ $product = $product->cloneFromDb;
cmp_deeply(
$product->getAllCollateral( 'relatedJSON' ),
[ { relatedAssetId => $imagedProduct->getId }, { relatedAssetId => $viewProduct->getId } ],
'added another related asset'
);
#----------------------------------------------------------------------------
@ -261,6 +272,7 @@ $product = $product->cloneFromDb;
cmp_deeply(
$product->getAllCollateral( 'benefitJSON' ),
[ { benefit => 'One new benefit', benefitId => ignore() } ],
'added a benefit'
);
$mech->submit_form_ok({
@ -277,6 +289,7 @@ cmp_deeply(
{ benefit => 'One new benefit', benefitId => ignore() },
{ benefit => 'Two new benefit', benefitId => ignore() },
],
'second benefit successfully added'
);
my $benefit = $product->getAllCollateral( 'benefitJSON' )->[0];
@ -294,6 +307,7 @@ cmp_deeply(
{ benefit => 'One edited benefit', benefitId => ignore() },
{ benefit => 'Two new benefit', benefitId => ignore() },
],
'benefit edited'
);
@ -315,6 +329,7 @@ $product = $product->cloneFromDb;
cmp_deeply(
$product->getAllCollateral( 'featureJSON' ),
[ { feature => 'One new feature', featureId => ignore() } ],
'added a feature'
);
$mech->submit_form_ok({
@ -331,6 +346,7 @@ cmp_deeply(
{ feature => 'One new feature', featureId => ignore() },
{ feature => 'Two new feature', featureId => ignore() },
],
'added another feature'
);
my $feature = $product->getAllCollateral( 'featureJSON' )->[0];
@ -348,6 +364,7 @@ cmp_deeply(
{ feature => 'One edited feature', featureId => ignore() },
{ feature => 'Two new feature', featureId => ignore() },
],
'edited a feature'
);
@ -373,6 +390,7 @@ cmp_deeply(
[
{ name => "One", value => "1", units => "Oneitude", specificationId => ignore(), },
],
'specification added'
);
$mech->submit_form_ok({
@ -391,6 +409,7 @@ cmp_deeply(
{ name => "One", value => "1", units => "Oneitude", specificationId => ignore(), },
{ name => "Cold", value => "2", units => "Colditude", specificationId => ignore(), },
],
'another specification added'
);
my $spec = $product->getAllCollateral( 'specificationJSON' )->[0];
@ -410,6 +429,7 @@ cmp_deeply(
{ name => "Oneitude", value => "3", units => "Ones", specificationId => $spec->{specificationId}, },
{ name => "Cold", value => "2", units => "Colditude", specificationId => ignore(), },
],
'specification edited'
);
@ -439,6 +459,7 @@ cmp_deeply(
[
{ %variantFlexo, variantId => ignore() },
],
'added a variant'
);
my %variantBender = (
@ -462,6 +483,7 @@ cmp_deeply(
{ %variantFlexo, variantId => ignore() },
{ %variantBender, variantId => ignore() },
],
'added another variant'
);
my $variant = $product->getAllCollateral( 'variantsJSON' )->[1];
@ -481,5 +503,7 @@ cmp_deeply(
{ %variantFlexo, variantId => ignore() },
{ %variantBender, variantId => ignore() },
],
'variant edited'
);
done_testing;

View file

@ -39,6 +39,7 @@ plan tests => 39; # Increment this number for each test you create
#----------------------------------------------------------------------------
# put your tests here
my $tag = WebGUI::VersionTag->getWorking($session);
my $sku = WebGUI::Test->asset(
className => "WebGUI::Asset::Sku::Subscription",
title => "Test Subscription",
@ -47,6 +48,8 @@ my $sku = WebGUI::Test->asset(
subscriptionGroup => $group->getId,
duration => 'Monthly',
);
$tag->commit;
$sku = $sku->cloneFromDb;
isa_ok($sku, "WebGUI::Asset::Sku::Subscription");
is($sku->getPrice, 50.00, "Price should be 50.00");

View file

@ -22,9 +22,8 @@ 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" );
WebGUI::Test->addToCleanup($versionTag);
my $snippet = $node->addChild({className=>'WebGUI::Asset::Snippet', %tag});
my $snippet = $node->addChild({className=>'WebGUI::Asset::Snippet', });
# Make sure TemplateToolkit is in the config file
WebGUI::Test->originalConfig( 'templateParsers' );
@ -77,7 +76,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', %tag } );
my $empty = $node->addChild( { className => 'WebGUI::Asset::Snippet', } );
is($empty->www_view, 'empty', 'www_view: snippet with no content returns "empty"');
#----------------------------------------------------------------------
@ -99,8 +98,7 @@ is $snippet->view(1), 'Cache test: 3', 'receive uncached content since view was
#Check packing
my $tag2 = WebGUI::VersionTag->getWorking($session);
$tag{tagId} = $tag2->getId;
my $snippet2 = $node->addChild({className => 'WebGUI::Asset::Snippet', %tag});
my $snippet2 = $node->addChild({className => 'WebGUI::Asset::Snippet', });
$snippet2->update({mimeType => 'text/javascript'});
$tag2->commit;
WebGUI::Test->addToCleanup($tag2);

View file

@ -54,6 +54,7 @@ $canEditMaker->prepare({
my $defaultNode = WebGUI::Test->asset;
my $tag = WebGUI::VersionTag->getWorking($session);
my $archive = $defaultNode->addChild({
className => 'WebGUI::Asset::Wobject::StoryArchive',
title => 'Test Archive',
@ -70,6 +71,9 @@ my $topic = $defaultNode->addChild({
keywords => 'tango,yankee',
});
$tag->commit;
$archive = $archive->cloneFromDb;
$topic = $topic->cloneFromDb;
my $storage1 = WebGUI::Storage->create($session);
my $storage2 = WebGUI::Storage->create($session);
WebGUI::Test->addToCleanup($storage1, $storage2);

View file

@ -24,7 +24,6 @@ use JSON qw{ from_json };
my $session = WebGUI::Test->session;
my $tag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup( $tag );
my %tag = ( tagId => $tag->getId, status => "pending" );
my $default = $session->config->get('defaultTemplateParser');
my $ht = 'WebGUI::Asset::Template::HTMLTemplate';
@ -43,12 +42,12 @@ ok($output =~ m/true/, "processRaw() - conditionals");
ok($output =~ m/\s(?:XY){5}\s/, "processRaw() - loops");
my $importNode = WebGUI::Test->asset;
my $template = $importNode->addChild({className=>"WebGUI::Asset::Template", title=>"test", url=>"testingtemplates", template=>$tmplText, namespace=>'WebGUI Test Template', %tag});
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"});
is($template->get('parser'), $default, "default parser is $default");
$template = $importNode->addChild({className=>"WebGUI::Asset::Template", title=>"test", url=>"testingtemplates", template=>$tmplText, namespace=>'WebGUI Test Template',parser=>$ht, %tag});
$template = $importNode->addChild({className=>"WebGUI::Asset::Template", title=>"test", url=>"testingtemplates", template=>$tmplText, namespace=>'WebGUI Test Template',parser=>$ht, });
isa_ok($template, 'WebGUI::Asset::Template', "creating a template");
@ -68,7 +67,6 @@ my $style = $importNode->addChild({
namespace => 'style',
template => '<IGOTSTYLE><tmpl_var body.content></IGOTSTYLE>',
parser => 'WebGUI::Asset::Template::HTMLTemplate',
%tag,
});
$template->style( $style->getId );
$output = $template->process({});
@ -82,7 +80,6 @@ $template = WebGUI::Test->asset(
template => '<tmpl_var NAME_header>',
namespace => 'WebGUI Test Template',
parser => $ht,
%tag,
);
my $form = WebGUI::FormBuilder->new( $session );
$template->addForm( NAME => $form );
@ -162,7 +159,6 @@ my $template3 = $importNode->addChild({
title => 'headBlock test',
template => "this is a template",
parser => $ht,
%tag,
}, undef, time()-5);
my @atts = (
@ -195,7 +191,7 @@ cmp_bag(
'attachments are duplicated'
) or diag( Dumper \@atts3dup );
my $template3rev = $template3->addRevision({%tag});
my $template3rev = $template3->addRevision({});
my $att4 = $template3rev->getAttachments('headScript');
is($att4->[0]->{url}, 'foo', 'rev has foo');
is($att4->[1]->{url}, 'bar', 'rev has bar');
@ -254,7 +250,6 @@ my $trashTemplate = $importNode->addChild({
title => 'Trash template',
template => q|Trash Trash Trash Trash|,
parser => $ht,
%tag
});
$trashTemplate->trash;
@ -280,7 +275,6 @@ my $brokenTemplate = $importNode->addChild({
title => 'Broken template',
template => q|<tmpl_if unclosedIf>If clause with no ending tag|,
parser => $ht,
%tag
});
WebGUI::Test->interceptLogging( sub {
@ -302,7 +296,6 @@ my $userStyleTemplate = $importNode->addChild({
template => "user function style",
namespace => 'WebGUI Test Template',
parser => $ht,
%tag
});
my $someOtherTemplate = $importNode->addChild({
@ -312,7 +305,6 @@ my $someOtherTemplate = $importNode->addChild({
template => "some other template",
namespace => 'WebGUI Test Template',
parser => $ht,
%tag
});
$session->setting->set('userFunctionStyleId', $userStyleTemplate->getId);

View file

@ -25,12 +25,11 @@ my $node = WebGUI::Test->asset;
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Wiki Test"});
WebGUI::Test->addToCleanup($versionTag);
my %tag = ( tagId => $versionTag->getId, status => "pending" );
my $wiki = $node->addChild({className=>'WebGUI::Asset::Wobject::WikiMaster', title => 'Wiki Test', url => 'wikitest',});
my @autoCommitCoda = (undef, undef, {skipAutoCommitWorkflows => 1, skipNotification => 1});
my $wikipage = $wiki->addChild(
{className=>'WebGUI::Asset::WikiPage',
title =>'wikipage', %tag},
title =>'wikipage', },
@autoCommitCoda,
);

View file

@ -23,7 +23,6 @@ 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" );
WebGUI::Test->addToCleanup($versionTag);
my $assetEdit = WebGUI::Group->new($session, "new");
@ -48,7 +47,6 @@ 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({

View file

@ -121,7 +121,6 @@ my $endDt = $startDt->clone->add(days => 2);
my $windowEnd = $endDt->clone->subtract(seconds => 1);
my $tag2 = WebGUI::VersionTag->getWorking($session);
my %tag = ( tagId => $tag2->getId, status => "pending" );
my $inside = $windowCal->addChild({
className => 'WebGUI::Asset::Event',
@ -129,7 +128,6 @@ my $inside = $windowCal->addChild({
startDate => $bday->toDatabaseDate,
endDate => $bday->toDatabaseDate,
timeZone => $tz,
%tag,
},);
my $insidewt = $windowCal->addChild({
@ -140,7 +138,6 @@ my $insidewt = $windowCal->addChild({
startTime => $bday->toDatabaseTime,
endTime => $bday->clone->add(hours => 1)->toDatabaseTime,
timeZone => $tz,
%tag,
},);
my $outsideHigh = $windowCal->addChild({
@ -149,7 +146,6 @@ my $outsideHigh = $windowCal->addChild({
startDate => $endDt->clone->add(days => 2)->toDatabaseDate,
endDate => $endDt->clone->add(days => 3)->toDatabaseDate,
timeZone => $tz,
%tag,
},);
my $outsideLow = $windowCal->addChild({
@ -158,7 +154,6 @@ my $outsideLow = $windowCal->addChild({
startDate => $startDt->clone->subtract(days => 3)->toDatabaseDate,
endDate => $startDt->clone->subtract(days => 2)->toDatabaseDate,
timeZone => $tz,
%tag,
},);
my $straddle = $windowCal->addChild({
@ -167,7 +162,6 @@ my $straddle = $windowCal->addChild({
startDate => $startDt->clone->subtract(days => 1)->toDatabaseDate,
endDate => $endDt->clone->add(days => 1)->toDatabaseDate,
timeZone => $tz,
%tag,
},);
my $straddlewt = $windowCal->addChild({
@ -178,7 +172,6 @@ my $straddlewt = $windowCal->addChild({
startTime => $startDt->clone->subtract(hours => 12)->toDatabaseTime,
endTime => $endDt->clone->add(hours => 12)->toDatabaseTime,
timeZone => $tz,
%tag,
},);
my $straddleLowwt = $windowCal->addChild({
@ -189,7 +182,6 @@ my $straddleLowwt = $windowCal->addChild({
startTime => $startDt->clone->subtract(hours => 12)->toDatabaseTime,
endTime => $startDt->clone->add(hours => 12)->toDatabaseTime,
timeZone => $tz,
%tag,
},);
my $straddleHighwt = $windowCal->addChild({
@ -200,7 +192,6 @@ my $straddleHighwt = $windowCal->addChild({
startTime => $endDt->clone->subtract(hours => 12)->toDatabaseTime,
endTime => $endDt->clone->add(hours => 12)->toDatabaseTime,
timeZone => $tz,
%tag,
},);
my $justBeforewt = $windowCal->addChild({
@ -211,7 +202,6 @@ my $justBeforewt = $windowCal->addChild({
startTime => $startDt->clone->subtract(hours => 1)->toDatabaseTime,
endTime => $startDt->toDatabaseTime,
timeZone => $tz,
%tag,
},);
my $justAfterwt = $windowCal->addChild({
@ -222,7 +212,6 @@ my $justAfterwt = $windowCal->addChild({
startTime => $endDt->toDatabaseTime,
endTime => $endDt->clone->add(hours => 1)->toDatabaseTime,
timeZone => $tz,
%tag,
}, );
my $justBefore = $windowCal->addChild({
@ -231,7 +220,6 @@ my $justBefore = $windowCal->addChild({
startDate => $startDt->clone->add(days => -1)->toDatabaseDate,
endDate => $startDt->clone->add(days => -1)->toDatabaseDate,
timeZone => $tz,
%tag,
},);
my $justAfter = $windowCal->addChild({
@ -240,7 +228,6 @@ my $justAfter = $windowCal->addChild({
startDate => $endDt->clone->add(days => 1)->toDatabaseDate,
endDate => $endDt->clone->add(days => 1)->toDatabaseDate,
timeZone => $tz,
%tag,
},);
my $starting = $windowCal->addChild({
@ -249,7 +236,6 @@ my $starting = $windowCal->addChild({
startDate => $startDt->toDatabaseDate,
endDate => $startDt->toDatabaseDate,
timeZone => $tz,
%tag,
}, );
my $ending = $windowCal->addChild({
@ -258,7 +244,6 @@ my $ending = $windowCal->addChild({
startDate => $endDt->clone->add(days => -1)->toDatabaseDate,
endDate => $endDt->clone->add(days => -1)->toDatabaseDate,
timeZone => $tz,
%tag,
},);
my $coincident = $windowCal->addChild({
@ -267,7 +252,6 @@ my $coincident = $windowCal->addChild({
startDate => $startDt->toDatabaseDate,
endDate => $endDt->toDatabaseDate,
timeZone => $tz,
%tag,
},);
my $coincidentLow = $windowCal->addChild({
@ -276,7 +260,6 @@ my $coincidentLow = $windowCal->addChild({
startDate => $startDt->toDatabaseDate,
endDate => $endDt->clone->add(days => 1)->toDatabaseDate,
timeZone => $tz,
%tag,
},);
my $coincidentHigh = $windowCal->addChild({
@ -285,7 +268,6 @@ my $coincidentHigh = $windowCal->addChild({
startDate => $startDt->clone->add( days => -1, )->toDatabaseDate,
endDate => $endDt->toDatabaseDate,
timeZone => $tz,
%tag,
},);
# no suffix = all day event

View file

@ -34,10 +34,9 @@ my $node = WebGUI::Test->asset;
my $versionTag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->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', %tag});
my $layout = $node->addChild({className => 'WebGUI::Asset::Wobject::Layout', });
# set the layout as the current asset for the same reason
$session->asset($layout);
@ -46,7 +45,6 @@ $session->asset($layout);
my $collab = $layout->addChild({
className => 'WebGUI::Asset::Wobject::Collaboration',
url => 'collab',
%tag,
});
$versionTag->commit;
@ -68,8 +66,6 @@ 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);
$thread->setSkipNotification;
@ -83,8 +79,6 @@ 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);
$thread2->setSkipNotification;

View file

@ -19,9 +19,12 @@ use Test::Deep;
use WebGUI::Test; # Must use this before any other WebGUI modules
use WebGUI::Session;
my $addArgs = { skipNotifications => 1, skipAutoCommitWorkflows => 1, };
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
my $tag = WebGUI::VersionTag->getWorking($session);
my $collab = WebGUI::Test->asset->addChild({
className => 'WebGUI::Asset::Wobject::Collaboration',
threadsPerPage => 20,
@ -33,28 +36,34 @@ my @threads = (
title => "X - Foo",
isSticky => 0,
threadRating => 4,
}, undef, 1, ),
}, undef, 1, $addArgs ),
$collab->addChild( {
className => 'WebGUI::Asset::Post::Thread',
title => "W - Bar",
isSticky => 0,
threadRating => 2,
}, undef, 2, ),
}, undef, 2, $addArgs ),
$collab->addChild( {
className => 'WebGUI::Asset::Post::Thread',
title => "Z - Baz",
isSticky => 1,
threadRating => 6,
}, undef, 3, ),
}, undef, 3, $addArgs ),
$collab->addChild( {
className => 'WebGUI::Asset::Post::Thread',
title => "Y - Shank",
isSticky => 1,
threadRating => 5,
}, undef, 4, ),
}, undef, 4, $addArgs ),
);
$_->setSkipNotification for @threads; # 100+ messages later...
$tag->commit;
foreach my $asset ($collab, @threads) {
$asset = $asset->cloneFromDb;
}
#----------------------------------------------------------------------------
# Tests

View file

@ -31,6 +31,8 @@ $user{"2"} = WebGUI::User->new( $session, "new" );
$user{"2"}->addToGroups( ['2'] ); # Registered user
WebGUI::Test->addToCleanup($user{'2'});
my $tag = WebGUI::VersionTag->getWorking($session);
my $collab
= $node->addChild({
className => "WebGUI::Asset::Wobject::Collaboration",
@ -41,6 +43,9 @@ my $collab
canStartThreadGroupId => 3, # Admin
},);
$tag->commit;
$collab = $collab->cloneFromDb;
#----------------------------------------------------------------------------
# Tests
plan tests => 36;

View file

@ -20,6 +20,8 @@ use Test::Deep;
use Data::Dumper;
use WebGUI::Session;
my $addArgs = { skipNotifications => 1, skipAutoCommitWorkflows => 1, };
#----------------------------------------------------------------------------
# Tests
plan tests => 23; # Increment this number for each test you create
@ -27,6 +29,7 @@ plan tests => 23; # Increment this number for each test you create
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
my $tag = WebGUI::VersionTag->getWorking($session);
my $collab = WebGUI::Test->asset->addChild({
className => 'WebGUI::Asset::Wobject::Collaboration',
threadsPerPage => 20,
@ -39,18 +42,23 @@ my @threads = (
title => "X - Foo",
isSticky => 0,
ownerUserId => 1,
}, undef, 1,),
}, undef, 1, $addArgs ),
$collab->addChild( {
className => 'WebGUI::Asset::Post::Thread',
title => "X - Bar",
isSticky => 0,
ownerUserId => 3,
}, undef, 2,),
}, undef, 2, $addArgs ),
);
for my $t ( @threads ) {
$t->setSkipNotification;
$t->commit;
}
$tag->commit;
foreach my $asset ($collab, @threads) {
$asset = $asset->cloneFromDb;
}
my $templateVars;
@ -104,9 +112,7 @@ foreach my $index (1 .. 5) {
title => "X - Bar",
isSticky => 0,
ownerUserId => 3,
tagId => $vt2->getId,
status => "pending",
}, undef, 2+$index);
}, undef, 2+$index, $addArgs );
$newThreads[$index]->setSkipNotification;
}
$vt2->commit;

View file

@ -28,6 +28,7 @@ use WebGUI::Session;
my $session = WebGUI::Test->session;
# Create a DataForm
my $tag = WebGUI::VersionTag->getWorking($session);
my $df = WebGUI::Test->asset
->addChild( {
className => "WebGUI::Asset::Wobject::DataForm",
@ -40,6 +41,9 @@ my $dform = WebGUI::Test->asset->addChild({
mailData => 0,
}, undef, time-5);
$dform->createField('gotCaptcha', { type => 'Captcha', name => 'humanCheck', });
$tag->commit;
$df = $df->cloneFromDb;
$dform = $dform->cloneFromDb;
#----------------------------------------------------------------------------
# Tests

View file

@ -45,21 +45,6 @@ my $node = WebGUI::Test->asset;
# 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
plan tests => 70; # Increment this number for each test you create
#----------------------------------------------------------------------------
# check base module and all related
use_ok('WebGUI::Asset::Wobject::EventManagementSystem');
use_ok('WebGUI::Asset::Sku::EMSBadge');
use_ok('WebGUI::Asset::Sku::EMSTicket');
use_ok('WebGUI::Asset::Sku::EMSRibbon');
use_ok('WebGUI::Asset::Sku::EMSToken');
# Add an EMS asset
my $ems = $node->addChild({
@ -70,10 +55,10 @@ my $ems = $node->addChild({
workflowIdCommit => 'pbworkflow000000000003', # Commit Content Immediately
registrationStaffGroupId => $registrars->getId,
groupIdView => $attendees->getId,
%tag
});
$versionTag->commit;
WebGUI::Test->addToCleanup($versionTag);
$ems = $ems->cloneFromDb;
# Test for a sane object type
isa_ok($ems, 'WebGUI::Asset::Wobject::EventManagementSystem');
@ -634,10 +619,13 @@ cmp_deeply( JSON::from_json($data), {
#----------------------------------------------------------------------------
# www_editBadgeGroup
my $ems_tag = WebGUI::VersionTag->getWorking($session);
$ems = WebGUI::Test->asset(
className => 'WebGUI::Asset::Wobject::EventManagementSystem',
groupIdEdit => '3',
);
$ems_tag->commit;
$ems = $ems->cloneFromDb;
my $mech = WebGUI::Test::Mechanize->new( config => WebGUI::Test->file );
$mech->get_ok('/');
@ -801,10 +789,13 @@ $mech->get_ok('/');
$mech->session->user({ userId => 3 });
# Need a badge
my $badger_tag = WebGUI::VersionTag->getWorking($session);
my $badger = $ems->addChild({
className => 'WebGUI::Asset::Sku::EMSBadge',
title => 'Badgers',
});
$badger_tag->commit;
$badger = $badger->cloneFromDb;
# Add cart and complete checkout
my $regBadgeId
= $session->db->setRow( 'EMSRegistrant', 'badgeId', {
@ -838,3 +829,4 @@ cmp_deeply(
"Registrant info saved correctly",
);
done_testing;

View file

@ -32,14 +32,12 @@ 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" );
WebGUI::Test->addToCleanup( $versionTag );
# Create gallery and a single album
my $gallery
= $node->addChild({
className => "WebGUI::Asset::Wobject::Gallery",
%tag,
});
my $album
@ -48,7 +46,6 @@ my $album
title => "album",
synopsis => "synopsis2",
keywords => "group2",
%tag,
});
my $albumId = $album->getId;
@ -60,7 +57,6 @@ my $photo1
synopsis => "synopsis1",
keywords => "group1",
location => "Heidelberg",
%tag,
});
my $id1 = $photo1->getId;
@ -71,7 +67,6 @@ my $photo2
synopsis => "synopsis2",
keywords => "group1",
location => "Mannheim",
%tag,
});
my $id2 = $photo2->getId;
@ -82,7 +77,6 @@ my $photo3
synopsis => "synopsis1",
keywords => "group2",
location => "Mannheim",
%tag,
});
my $id3 = $photo3->getId;

View file

@ -23,7 +23,6 @@ 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"});
WebGUI::Test->addToCleanup($versionTag);
@ -35,14 +34,12 @@ my $gallery
groupIdView => 7, # Everyone
groupIdEdit => 3, # Admins
ownerUserId => 3, # Admin
%tag,
});
my $album
= $gallery->addChild({
className => "WebGUI::Asset::Wobject::GalleryAlbum",
ownerUserId => "3", # Admin
%tag,
});
$versionTag->commit;
@ -63,8 +60,6 @@ my $properties = {
keywords => "something",
location => "somewhere",
friendsOnly => "1",
tagId => $versionTag->getId,
status => "pending",
};
$album->addArchive( WebGUI::Test->getTestCollateralPath('elephant_images.zip'), $properties );
@ -128,7 +123,6 @@ $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,7 +137,6 @@ 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
@ -158,7 +151,6 @@ 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

@ -22,6 +22,7 @@ my $session = WebGUI::Test->session;
my $node = WebGUI::Test->asset;
# Create gallery and a single album
my $tag = WebGUI::VersionTag->getWorking($session);
my $gallery
= $node->addChild({
className => "WebGUI::Asset::Wobject::Gallery",
@ -38,16 +39,13 @@ for (my $i = 0; $i < 5; $i++)
$photo[$i]
= $album->addChild({
className => "WebGUI::Asset::File::GalleryFile::Photo",
});
}, undef, undef, { skipNotifications => 1, skipAutoCommitWorkflows => 1, });
}
#----------------------------------------------------------------------------
# Tests
plan tests => 15;
#----------------------------------------------------------------------------
# Test module compiles okay
use_ok("WebGUI::Asset::Wobject::GalleryAlbum");
$tag->commit;
foreach my $asset ($gallery, $album, @photo) {
$asset = $asset->cloneFromDb;
}
#----------------------------------------------------------------------------
# Test getPreviousFileId
@ -75,4 +73,6 @@ is( $album->getNextFileId(''), undef, 'Return undef if empty string specified');
is( $album->getNextFileId('123456'), undef, 'Return undef if non-existing id specified');
is( $album->getNextFileId($album->getId), undef, 'Return undef if non-child id specified');
done_testing;
#vim:ft=perl

View file

@ -26,7 +26,6 @@ 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({
@ -36,13 +35,11 @@ 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
%tag,
});
my @photos;
for my $i ( 0 .. 5 ) {
@ -50,7 +47,6 @@ for my $i ( 0 .. 5 ) {
= $album->addChild({
className => "WebGUI::Asset::File::GalleryFile::Photo",
filename => "$i.jpg",
%tag,
});
}

View file

@ -18,7 +18,7 @@ use WebGUI::Test;
use WebGUI::Test::MockAsset;
use WebGUI::Test::Mechanize;
use WebGUI::Session;
use Test::More tests => 27; # increment this value for each test you create
use Test::More; # increment this value for each test you create
use Test::Deep;
use Data::Dumper;
@ -45,9 +45,12 @@ foreach my $name (@names) {
}
WebGUI::Test->addToCleanup(@users);
my $tag = WebGUI::VersionTag->getWorking($session);
my $board = WebGUI::Test->asset(
className => 'WebGUI::Asset::Wobject::InOutBoard',
);
$tag->commit;
$board = $board->cloneFromDb;
$board->prepareView();
@ -176,10 +179,13 @@ is ($count, 0, '... cleans up statusLog table');
#----------------------------------------------------------------------------
# selectDelegates
my $tag2 = WebGUI::VersionTag->getWorking($session);
$board = WebGUI::Test->asset(
className => 'WebGUI::Asset::Wobject::InOutBoard',
inOutGroup => '7', # everyone
);
$tag2->commit;
$board = $board->cloneFromDb;
my $mech = WebGUI::Test::Mechanize->new( config => WebGUI::Test->file );
$mech->get_ok( '/' );
@ -238,3 +244,5 @@ $mech->submit_form_ok( {
# Report was ok!
$mech->content_lacks( "No sleep till Brooklyn!" );
$mech->content_contains( "Sleeping till Brooklyn!" );
done_testing;

View file

@ -15,7 +15,7 @@ use File::Spec;
use WebGUI::Test;
use WebGUI::Session;
use Test::More tests => 30; # increment this value for each test you create
use Test::More; # increment this value for each test you create
use Test::Deep;
use JSON;
use WebGUI::Asset::Wobject::Matrix;
@ -26,10 +26,11 @@ 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',%tag});
my $matrix = $node->addChild({className=>'WebGUI::Asset::Wobject::Matrix'});
$versionTag->commit;
$matrix = $matrix->cloneFromDb;
# Test for a sane object type
isa_ok($matrix, 'WebGUI::Asset::Wobject::Matrix');
@ -103,7 +104,10 @@ is($newAttribute->{attributeId},undef,"The new attribute was successfully delete
# add a listing
my $listing_tag = WebGUI::VersionTag->getWorking($session);
my $matrixListing = $matrix->addChild({className=>'WebGUI::Asset::MatrixListing'}, undef, undef, { skipNotification => 1});
$listing_tag->commit;
$matrixListing = $matrixListing->cloneFromDb;
WebGUI::Test->addToCleanup($matrixListing);
@ -441,3 +445,5 @@ cmp_deeply(
},
'statistics calculated for the category with 10 ratings'
);
done_testing;

View file

@ -26,10 +26,13 @@ use WebGUI::Session;
# Init
my $session = WebGUI::Test->session;
my $tag = WebGUI::VersionTag->getWorking($session);
my $pm = WebGUI::Test->asset(
className => 'WebGUI::Asset::Wobject::ProjectManager',
groupToAdd => 3,
);
$tag->commit;
$pm = $pm->cloneFromDb;
#----------------------------------------------------------------------------
# Tests

View file

@ -27,9 +27,10 @@ my $node = WebGUI::Asset->getDefault($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Search Test"});
my %tag = ( tagId => $versionTag->getId, status => "pending" );
WebGUI::Test->addToCleanup($versionTag);
my $search = $node->addChild({className=>'WebGUI::Asset::Wobject::Search', %tag});
my $search = $node->addChild({className=>'WebGUI::Asset::Wobject::Search'});
$versionTag->commit;
$search = $search->cloneFromDb;
# Test for a sane object type
isa_ok($search, 'WebGUI::Asset::Wobject::Search');
@ -89,14 +90,12 @@ $search->update({
{
my $versionTag2 = WebGUI::VersionTag->getWorking($session);
$tag{tagId} = $versionTag2->getId;
$versionTag2->set({name=>"Collab setup"});
my @addArgs = ( undef, undef, { skipNotification => 1 } );
my @addArgs = ( undef, undef, { skipNotification => 1, skipAutoCommitWorkflows => 1, } );
my $collab = $node->addChild({
className => 'WebGUI::Asset::Wobject::Collaboration',
editTimeout => '1',
threadsPerPage => 3,
%tag,
},
@addArgs);
# finally, add the post to the collaboration system
@ -104,7 +103,6 @@ $search->update({
className => 'WebGUI::Asset::Post::Thread',
content => 'verbosity shale anything',
ownerUserId => 1,
%tag,
};
my $thread = $collab->addChild($props, @addArgs);
@ -132,12 +130,10 @@ $search->update({
# Test useContainers when the user cannot view the container
my $versionTag3 = WebGUI::VersionTag->getWorking($session);
$versionTag3->set({name=>"Folder setup"});
$tag{tagId} = $versionTag3->getId;
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1 } );
my $folder = $node->addChild({
className => 'WebGUI::Asset::Wobject::Folder',
groupIdView => '3', # Admins
%tag,
},
@addArgs);
# add an article anyone can see
@ -145,8 +141,6 @@ $search->update({
className => 'WebGUI::Asset::Wobject::Article',
synopsis => 'juxtaposition coolwhip cheezewhiz',
groupIdView => '7', # Everyone
tagId => $versionTag3->getId,
status => 'pending',
};
my $snippet = $folder->addChild($props, @addArgs);
@ -161,7 +155,6 @@ $search->update({
$search->prepareView;
$search->view;
$search->update({useContainers => 0});
note( explain $templateVars );
is $templateVars->{result_set}->[0]->{url}, $snippet->get('url'), 'search returns regular URL for article';
$search->update({useContainers => 1});
$search->view;

View file

@ -27,30 +27,25 @@ 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',
parser => 'WebGUI::Asset::Template::HTMLTemplate',
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,
});
$tag2->commit;

View file

@ -74,13 +74,11 @@ my @skipAutoCommit = WebGUI::Test->getAssetSkipCoda;
my $home = WebGUI::Test->asset;
$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->commit;
WebGUI::Test->addToCleanup($versionTag);
@ -195,8 +193,7 @@ isa_ok($child, 'WebGUI::Asset::Wobject::Folder', '... will add folders, so impor
$child->purge;
my $tag1 = WebGUI::VersionTag->getWorking($session);
$tag{tagId} = $tag1->getId;
$child = $archive->addChild({className => 'WebGUI::Asset::Story', title => 'First Story', %tag}, @skipAutoCommit);
$child = $archive->addChild({className => 'WebGUI::Asset::Story', title => 'First Story', }, @skipAutoCommit);
$tag1->commit;
WebGUI::Test->addToCleanup($tag1);
isa_ok($child, 'WebGUI::Asset::Story', 'addChild added and returned a Story');
@ -233,8 +230,7 @@ my ($wgBdayMorn,undef) = $session->datetime->dayStartEnd($wgBday);
my ($yesterdayMorn,undef) = $session->datetime->dayStartEnd($yesterday);
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);
my $story = $oldFolder->addChild({ className => 'WebGUI::Asset::Story', title => 'WebGUI is released', keywords => 'roger,foxtrot,echo,all', }, @skipAutoCommit);
$creationDateSth->execute([$wgBday, $story->getId]);
$tag2->commit;
WebGUI::Test->addToCleanup($tag2);
@ -245,8 +241,7 @@ WebGUI::Test->addToCleanup($tag2);
}
my $tag3 = WebGUI::VersionTag->getWorking($session);
$tag{tagId} = $tag3->getId;
my $pastStory = $newFolder->addChild({ className => 'WebGUI::Asset::Story', title => "Yesterday is history", %tag }, @skipAutoCommit);
my $pastStory = $newFolder->addChild({ className => 'WebGUI::Asset::Story', title => "Yesterday is history", }, @skipAutoCommit);
$creationDateSth->execute([$yesterday, $pastStory->getId]);
$tag3->commit;
WebGUI::Test->addToCleanup($tag3);
@ -317,10 +312,9 @@ cmp_deeply(
);
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);
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);
foreach my $storilet ($story2, $story3, $story4) {
$session->db->write("update asset set creationDate=$now where assetId=?",[$storilet->getId]);
}

View file

@ -29,7 +29,10 @@ WebGUI::Test->addToCleanup($user);
my $import_node = WebGUI::Test->asset;
# Create a Survey
my $tag = WebGUI::VersionTag->getWorking($session);
$survey = $import_node->addChild( { className => 'WebGUI::Asset::Wobject::Survey', } );
$tag->commit;
$survey = $survey->cloneFromDb;
isa_ok($survey, 'WebGUI::Asset::Wobject::Survey');
my $sJSON = $survey->getSurveyJSON;

View file

@ -33,7 +33,10 @@ $templateMock->mock_id($templateId);
my $templateVars;
$templateMock->mock('process', sub { $templateVars = $_[1]; } );
my $tag = WebGUI::VersionTag->getWorking($session);
my $thingy = $node->addChild({className=>'WebGUI::Asset::Wobject::Thingy'});
$tag->commit;
$thingy = $thingy->cloneFromDb;
# Test for a sane object type
isa_ok($thingy, 'WebGUI::Asset::Wobject::Thingy');
@ -522,9 +525,12 @@ cmp_deeply( $field, superhashof( \%fieldInfo ), 'field info saved' );
#----------------------------------------------------------------------------
# www_importForm
my $tag2 = WebGUI::VersionTag->getWorking($session);
my $thingy = WebGUI::Test->asset(
className => 'WebGUI::Asset::Wobject::Thingy',
);
$tag2->commit;
$thingy = $thingy->cloneFromDb;
my $thingId = $thingy->addThing();
my @fieldIds = (
$thingy->addField({

View file

@ -39,8 +39,6 @@ my $thingy = $node->addChild({
className => 'WebGUI::Asset::Wobject::Thingy',
groupIdView => 7,
url => 'some_thing',
tagId => $versionTag->getId,
status => "pending",
});
is $session->db->quickScalar('select count(*) from assetIndex where assetId=?',[$thingy->getId]), 0, 'no records yet';
$versionTag->commit;
@ -268,7 +266,7 @@ is @{ $search->getAssetIds }, 3, 'setup for indexContent, start with 3 records..
my $updateTag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($updateTag);
$thingy = $thingy->addRevision({ url => 'wild_thing', tagId => $updateTag->getId, status => "pending" });
$thingy = $thingy->addRevision({ url => 'wild_thing',});
$updateTag->commit;
$thingy = $thingy->cloneFromDb;

View file

@ -29,11 +29,14 @@ $SIG{HUP} = sub { use Carp; confess "hup"; };
# Init
my $session = WebGUI::Test->session;
my $tag = WebGUI::VersionTag->getWorking($session);
my $asset = WebGUI::Test->asset->addChild( {
className => 'WebGUI::Asset::Snippet',
url => 'example',
groupIdEdit => 3, # Admins
} );
$tag->commit;
$asset = $asset->cloneFromDb;
#----------------------------------------------------------------------------
# Check permissions

View file

@ -22,8 +22,6 @@ use WebGUI::Asset;
use WebGUI::AssetHelper::Copy;
use WebGUI::Test::Mechanize;
$SIG{HUP} = sub { use Carp; confess "hup"; };
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
@ -57,6 +55,7 @@ my $root = WebGUI::Asset->getRoot($session);
WebGUI::Test->addToCleanup( 'WebGUI::Fork' => $output->{forkId} );
}
ok(WebGUI::Test->waitForAllForks(10), "Forks finished");
$session->cache->clear;

View file

@ -39,25 +39,25 @@ 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,
});
$tag->commit;
WebGUI::Test->addToCleanup( $tag );
foreach my $asset ($top, $child, $grand) {
$asset = $asset->cloneFromDb;
}
{
my $helper = WebGUI::AssetHelper::CopyBranch->new( id => 'copy_branch', session => $session, asset => $top );
$output = $helper->process;
@ -76,7 +76,7 @@ WebGUI::Test->addToCleanup( $tag );
my $mech = WebGUI::Test::Mechanize->new( config => WebGUI::Test->file );
$mech->get_ok( '/?op=assetHelper;helperId=copy_branch;method=copy;with=children;assetId=' . $top->getId );
WebGUI::Test->waitForAllForks;
WebGUI::Test->waitForAllForks(10);
my $clippies = $root->getLineage(["descendants"], {statesToInclude => [qw{clipboard clipboard-limbo}], returnObjects => 1,});
is @{ $clippies }, 2, '... copied 2 asset to the clipboard';
@ -85,7 +85,7 @@ for my $asset ( @$clippies ) {
}
$mech->get_ok( '/?op=assetHelper;helperId=copy_branch;method=copy;with=descendants;assetId=' . $top->getId );
WebGUI::Test->waitForAllForks;
WebGUI::Test->waitForAllForks(10);
my $clippies = $root->getLineage(["descendants"], {statesToInclude => [qw{clipboard clipboard-limbo}], returnObjects => 1,});
is @{ $clippies }, 3, '... copied 3 asset to the clipboard';
WebGUI::Test->addToCleanup( @$clippies );

View file

@ -48,9 +48,11 @@ cmp_deeply(
$session->setting->set( versionTagMode => 'autoCommit' );
$session->setting->set( skipCommitComments => '1' );
$session->user({userId => 3});
my $tag = WebGUI::VersionTag->getWorking($session);
my $safe_page = WebGUI::Test->asset;
my $helper = WebGUI::AssetHelper::CreateShortcut->new( id => 'shortcut', session => $session, asset => $safe_page );
$output = $helper->process;
$tag->commit;
cmp_deeply(
$output,
{

View file

@ -32,6 +32,7 @@ $session->user({ userId => 3 });
my $output;
my $node = WebGUI::Asset->getImportNode($session);
my $root = WebGUI::Asset->getRoot( $session );
my $tag = WebGUI::VersionTag->getWorking($session);
my $top = $node->addChild({
className => 'WebGUI::Asset::Wobject::Layout',
title => 'Top',
@ -52,6 +53,7 @@ my $grand = $child->addChild({
groupIdView => '7',
});
WebGUI::Test->addToCleanup( $top );
$tag->commit;
my $dir = File::Temp->newdir;
WebGUI::Test->originalConfig( "exportPath" );

View file

@ -36,12 +36,14 @@ $editor->addToGroups([4]);
WebGUI::Test->addToCleanup($editor);
$session->user({userId => 3});
my $tag = WebGUI::VersionTag->getWorking($session);
my $newPage = $home->addChild({
className => 'WebGUI::Asset::Wobject::Layout',
title => 'Test page',
groupIdEdit => '4',
ownerUserId => '3',
}, undef, WebGUI::Test->webguiBirthday, { skipAutoCommitWorkflows => 1, });
$tag->commit;
$newPage = WebGUI::Asset->newById($session, $newPage->assetId);

View file

@ -36,6 +36,7 @@ my $session = WebGUI::Test->session;
my $root = WebGUI::Test->asset;
my $class = 'WebGUI::Asset::Wobject::Shelf';
my $tag = WebGUI::VersionTag->getWorking($session);
my $shelf = $root->addChild({className => $class});
my $soda = [
@ -78,6 +79,8 @@ $shelf->addChild({
title => 'Shirts',
sku => 't-shirt',
});
$tag->commit;
my $helper = WebGUI::AssetHelper::Product::ExportCSV->new(
id => 'exportProducts',
session => $session,

View file

@ -29,7 +29,6 @@ use WebGUI::Test::Mechanize;
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
my $node = WebGUI::Test->asset;
# Override some settings to make things easier to test
# userFunctionStyleId
@ -55,6 +54,8 @@ my ($redirect, $response, $url);
my $baseUrl = 'http://localhost/';
# Make an asset we can login on
my $tag = WebGUI::VersionTag->getWorking($session);
my $node = WebGUI::Test->asset;
my $asset
= $node->addChild({
className => 'WebGUI::Asset::Wobject::Article',
@ -65,6 +66,9 @@ my $asset
styleTemplateId => 'PBtmpl0000000000000132',
});
my $assetUrl = $baseUrl . $asset->get('url');
$tag->commit;
my $node = $node->cloneFromDb;
my $asset = $asset->cloneFromDb;
#----------------------------------------------------------------------------
# Tests

View file

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

View file

@ -22,7 +22,10 @@ use Data::Dumper;
my $session = WebGUI::Test->session;
# put your tests here
my $tag = WebGUI::VersionTag->getWorking($session);
my $home = WebGUI::Test->asset;
$tag->commit;
$home = $home->cloneFromDb;
isa_ok($home, "WebGUI::Asset");
my $keyword = WebGUI::Keyword->new($session);

View file

@ -30,7 +30,6 @@ my $session = WebGUI::Test->session;
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Adding assets for RootTitle tests"});
my %tag = ( tagId => $versionTag->getId, status => "pending" );
WebGUI::Test->addToCleanup($versionTag);
my $root = WebGUI::Asset->getRoot($session);
@ -42,7 +41,6 @@ my %properties_A = (
ownerUserId => 3,
groupIdView => 7,
groupIdEdit => 3,
%tag,
id => 'RootA-----------------',
# '1234567890123456789012'
);

View file

@ -91,6 +91,7 @@ my $foreignHammer = $rockHammer->setCollateral('variantsJSON', 'variantId', 'new
$versionTag->commit;
$rockHammer = $rockHammer->cloneFromDb;
$cart->update({gatewayId => 'gzUxkEZJxREF9JpylOg2zw',}); ##Cash checkout
my $transaction = WebGUI::Shop::Transaction->new($session, {
cart => $cart,

View file

@ -159,24 +159,22 @@ $tag2->rollback;
($tag, $tagAgain1, $tag2, $tagAgain2) = ();
my $tag3 = WebGUI::VersionTag->create($session, {});
my %tag = ( tagId => $tag3->getId, status => "pending" );
$tag3->setWorking;
my $asset1 = WebGUI::Test->asset->addChild({ className => 'WebGUI::Asset::Snippet', %tag });
my $asset2 = WebGUI::Test->asset->addChild({ className => 'WebGUI::Asset::Snippet', %tag });
my $asset1 = WebGUI::Test->asset->addChild({ className => 'WebGUI::Asset::Snippet', });
my $asset2 = WebGUI::Test->asset->addChild({ className => 'WebGUI::Asset::Snippet', });
is($tag3->getAssetCount, 2, 'tag with two assets');
is($tag3->getRevisionCount, 2, 'tag with two revisions');
$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);
$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);
is($tag3->getRevisionCount, 5, 'tag with five revisions');
my $tag4 = WebGUI::VersionTag->create($session, {});
$tag{tagId} = $tag4->getId;
$tag4->setWorking;
my $asset3 = WebGUI::Test->asset->addChild({ className => 'WebGUI::Asset::Snippet', %tag });
my $asset3 = WebGUI::Test->asset->addChild({ className => 'WebGUI::Asset::Snippet', });
is($tag4->getAssetCount, 1, 'other tag with one asset');
is($tag4->getRevisionCount, 1, 'other tag with one revision');
$asset3->addRevision({ title => 'again revised once', %tag }, time+40);
$asset3->addRevision({ title => 'again revised once', }, 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');
@ -187,9 +185,8 @@ $tag4->rollback;
#Test commitAsUser
my $tag5 = WebGUI::VersionTag->create($session, {});
$tag{tagId} = $tag5->getId;
$tag5->setWorking;
my $asset5 = WebGUI::Test->asset->addChild({ className => 'WebGUI::Asset::Snippet', %tag });
my $asset5 = WebGUI::Test->asset->addChild({ className => 'WebGUI::Asset::Snippet', });
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
@ -199,9 +196,8 @@ $tag5->rollback;
#Test commitAsUser with options
my $tag6 = WebGUI::VersionTag->create($session, {});
$tag{tagId} = $tag6->getId;
$tag6->setWorking;
my $asset6 = WebGUI::Test->asset->addChild({ className => 'WebGUI::Asset::Snippet', %tag });
my $asset6 = WebGUI::Test->asset->addChild({ className => 'WebGUI::Asset::Snippet', });
$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');
@ -324,9 +320,8 @@ $siteWideTag->rollback();
setUserVersionTagMode($user, q{singlePerUser});
my $tag = WebGUI::VersionTag->create($session, {});
$tag{ tagId } = $tag->getId;
$tag->setWorking;
my $asset = WebGUI::Test->asset->addChild({ className => 'WebGUI::Asset::Snippet', %tag });
my $asset = WebGUI::Test->asset->addChild({ className => 'WebGUI::Asset::Snippet', });
is($tag->getAssetCount, 1, qq{$test_prefix [singlePerUser] tag with 1 asset});
# create admin session
@ -376,9 +371,8 @@ $siteWideTag->rollback();
setUserVersionTagMode($user, q{siteWide});
$tag = WebGUI::VersionTag->create($session, {});
$tag{tagId} = $tag->getId;
$tag->setWorking;
$asset = WebGUI::Test->asset->addChild({ className => 'WebGUI::Asset::Snippet', %tag });
$asset = WebGUI::Test->asset->addChild({ className => 'WebGUI::Asset::Snippet', });
is($tag->getAssetCount, 1, qq{$test_prefix [siteWide] tag with 1 asset});
# create admin session

View file

@ -30,6 +30,8 @@ my $wgBday = WebGUI::Test->webguiBirthday;
my $creationDateSth = $session->db->prepare('update asset set creationDate=? where assetId=?');
my $tag = WebGUI::VersionTag->getWorking($session);
my $archive1 = $home->addChild({
className => 'WebGUI::Asset::Wobject::StoryArchive',
title => '2001 Stories',
@ -57,6 +59,8 @@ my $weekFolder = $archive2->getFolder($weekAgo);
my $weekStory = $weekFolder->addChild({className => 'WebGUI::Asset::Story',});
$creationDateSth->execute([$weekAgo, $weekFolder->getId]);
$creationDateSth->execute([$weekAgo, $weekStory->getId]);
$tag->commit;
WebGUI::Test->addToCleanup($tag);
my $workflow = WebGUI::Workflow->create($session,
{

View file

@ -20,6 +20,8 @@ use Data::Dumper;
my $session = WebGUI::Test->session;
my $temp = WebGUI::Test->asset;
my $tag = WebGUI::VersionTag->getWorking($session);
my $calendar = $temp->addChild(
{ className => 'WebGUI::Asset::Wobject::Calendar' }
);
@ -75,6 +77,9 @@ $clipped_event->setRecurrence(
}
);
$tag->commit;
WebGUI::Test->addToCleanup($tag);
my $workflow = WebGUI::Workflow->create(
$session, {
enabled => 1,

View file

@ -32,6 +32,8 @@ my $inbox = WebGUI::Inbox->new($session);
my $import = WebGUI::Test->asset;
my $tag = WebGUI::VersionTag->getWorking($session);
my $posters = $import->addChild({
className => 'WebGUI::Asset::Sku::Product',
url => 'cell_posters',
@ -68,6 +70,9 @@ my $marilynVarId = $posters->setCollateral('variantsJSON', 'variantId', 'new',
},
);
$tag->commit;
WebGUI::Test->addToCleanup($tag);
my $workflow = WebGUI::Workflow->create($session,
{
enabled => 1,
@ -150,6 +155,7 @@ WebGUI::Test->addToCleanup(sub {
$session->db->write("delete from Product where assetId=?",[$otherPosters->getId]);
$session->db->write("delete from assetIndex where assetId=?",[$otherPosters->getId]);
});
my $otherTag = WebGUI::VersionTag->getWorking($session);
my $movie_posters = $import->addChild({
className => 'WebGUI::Asset::Sku::Product',
url => 'movie_posters',
@ -165,7 +171,6 @@ my $movieVarId = $movie_posters->setCollateral('variantsJSON', 'variantId', 'new
quantity => 5,
},
);
my $otherTag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($otherTag);
$otherTag->commit;

View file

@ -110,8 +110,6 @@ sub getAnchoredAsset {
my @parents = $test->getMyParents;
my $asset = $parents[-1]->addChild({
className => $test->class,
status => "pending",
tagId => $tag->getId,
$test->constructorExtras($session),
}, undef, (time-10), {skipNotification => 1});
# warn "XXX getAnchoredAsset: created new asset of Id: " . $asset->getId . ' of type: ' . ref $asset;
@ -146,8 +144,6 @@ sub getMyParents {
{
className => $parent_class,
$test->constructorExtras($session),
status => 'pending',
tagId => $tag->getId,
},
undef,
(time-10),