almost done fixing addRevision changes
This commit is contained in:
parent
3ce9198220
commit
1866c593ea
25 changed files with 186 additions and 199 deletions
|
|
@ -245,7 +245,7 @@ sub _set_inheritUrlFromParent {
|
|||
property status => (
|
||||
noFormPost => 1,
|
||||
fieldType => 'text',
|
||||
default => 'pending',
|
||||
default => 'approved',
|
||||
);
|
||||
property lastModified => (
|
||||
noFormPost => 1,
|
||||
|
|
|
|||
|
|
@ -455,7 +455,9 @@ sub www_editSubmissionSave {
|
|||
my $formParams = $self->processForm;
|
||||
if( $formParams->{_isValid} ) {
|
||||
delete $formParams->{_isValid};
|
||||
$self->addRevision($formParams);
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
my $newRevision = $self->addRevision({%$formParams,tagId => $tag->getId, status => "pending",});
|
||||
$newRevision->setVersionLock;
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, { override => 1, allowComments => 0 });
|
||||
$self = $self->cloneFromDb;
|
||||
$self->sendEmailUpdate;
|
||||
|
|
|
|||
|
|
@ -334,7 +334,9 @@ sub www_editSubmissionFormSave {
|
|||
my $formParams = $self->processForm();
|
||||
if( $formParams->{_isValid} ) {
|
||||
delete $formParams->{_isValid};
|
||||
$self->addRevision($formParams);
|
||||
my $tag = WebGUI::VersionTag->getWorking( $self->session );
|
||||
my $newRevision = $self->addRevision({%$formParams,tagId => $tag->getId, status => "pending",});
|
||||
$newRevision->setVersionLock;
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
|
||||
$self = $self->cloneFromDb;
|
||||
return $self->getParent->www_viewSubmissionQueue;
|
||||
|
|
|
|||
|
|
@ -1391,16 +1391,7 @@ override processEditForm => sub {
|
|||
return \@errors;
|
||||
}
|
||||
|
||||
# Since we may be adding more events, set out version tag to be active if needed
|
||||
# Leave the original version tag available, we will need to reactivate it before returning
|
||||
my $activeVersionTag = WebGUI::VersionTag->getWorking($session, 'nocreate');
|
||||
# if our version tag is active, we don't need a new one, and don't need to reactivate anything later
|
||||
if ($activeVersionTag && $activeVersionTag->getId eq $self->get('tagId')) {
|
||||
undef $activeVersionTag;
|
||||
}
|
||||
else {
|
||||
WebGUI::VersionTag->new($session, $self->tagId)->setWorking;
|
||||
}
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
|
||||
### Form is verified, fix properties
|
||||
if (!$session->form->hasParam('groupIdView')) {
|
||||
|
|
@ -1535,8 +1526,6 @@ override processEditForm => sub {
|
|||
if ($recurrence_new) {
|
||||
my $new_id = $self->setRecurrence($recurrence_new);
|
||||
if (! $new_id) {
|
||||
$activeVersionTag->setWorking
|
||||
if $activeVersionTag;
|
||||
return ["There is something wrong with your recurrence pattern."];
|
||||
}
|
||||
|
||||
|
|
@ -1592,14 +1581,15 @@ override processEditForm => sub {
|
|||
# Add a revision
|
||||
$properties{ startDate } = $event->startDate;
|
||||
$properties{ endDate } = $event->endDate;
|
||||
$properties{ tagId } = $tag->getId;
|
||||
$properties{ status } = "pending";
|
||||
|
||||
# addRevision returns the new revision
|
||||
$event = $event->addRevision(\%properties, undef, { skipAutoCommitWorkflows => 1 });
|
||||
$event = $event->addRevision(\%properties);
|
||||
$event->setVersionLock;
|
||||
}
|
||||
}
|
||||
}
|
||||
$activeVersionTag->setWorking
|
||||
if $activeVersionTag;
|
||||
|
||||
delete $self->{_storageLocation};
|
||||
return undef;
|
||||
|
|
|
|||
|
|
@ -321,7 +321,9 @@ sub www_annotate {
|
|||
return $session->privilege->insufficient() unless $self->canEdit;
|
||||
return $session->privilege->locked() unless $self->canEditIfLocked;
|
||||
if (1) {
|
||||
my $newSelf = $self->addRevision();
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
my $newSelf = $self->addRevision({ tagId => $tag->getId, status => "pending" });
|
||||
$newSelf->setVersionLock;
|
||||
delete $newSelf->{_storageLocation};
|
||||
$newSelf->getStorageLocation->annotate($newSelf->filename,$newSelf,$session->form);
|
||||
$newSelf->setSize($newSelf->getStorageLocation->getFileSize($newSelf->filename));
|
||||
|
|
@ -540,7 +542,9 @@ sub www_rotate {
|
|||
return $session->privilege->insufficient() unless $self->canEdit;
|
||||
return $session->privilege->locked() unless $self->canEditIfLocked;
|
||||
if (defined $session->form->process("Rotate")) {
|
||||
my $newSelf = $self->addRevision();
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
my $newSelf = $self->addRevision({ tagId => $tag->getId, status => "pending" });
|
||||
$newSelf->setVersionLock;
|
||||
delete $newSelf->{_storageLocation};
|
||||
$newSelf->getStorageLocation->rotate($newSelf->filename,$session->form->process("Rotate"));
|
||||
$newSelf->setSize($newSelf->getStorageLocation->getFileSize($newSelf->filename));
|
||||
|
|
@ -599,7 +603,9 @@ sub www_resize {
|
|||
return $session->privilege->insufficient() unless $self->canEdit;
|
||||
return $session->privilege->locked() unless $self->canEditIfLocked;
|
||||
if ($session->form->process("newWidth") || $session->form->process("newHeight")) {
|
||||
my $newSelf = $self->addRevision();
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
my $newSelf = $self->addRevision({ tagId => $tag->getId, status => "pending" });
|
||||
$newSelf->setVersionLock;
|
||||
delete $newSelf->{_storageLocation};
|
||||
$newSelf->getStorageLocation->resize($newSelf->filename,$session->form->process("newWidth"),$session->form->process("newHeight"));
|
||||
$newSelf->setSize($newSelf->getStorageLocation->getFileSize($newSelf->filename));
|
||||
|
|
@ -707,7 +713,9 @@ sub www_crop {
|
|||
|
||||
if ($session->form->process("Width") || $session->form->process("Height")
|
||||
|| $session->form->process("Top") || $session->form->process("Left")) {
|
||||
my $newSelf = $self->addRevision();
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
my $newSelf = $self->addRevision({ tagId => $tag->getId, status => "pending" });
|
||||
$newSelf->setVersionLock;
|
||||
delete $newSelf->{_storageLocation};
|
||||
$newSelf->getStorageLocation->crop(
|
||||
$newSelf->filename,
|
||||
|
|
|
|||
|
|
@ -837,7 +837,9 @@ sub www_editDuplicate {
|
|||
next PROP unless lc $properties->{ $prop }->{ fieldType } eq "template";
|
||||
next PROP unless $asset->get( $prop ) eq $self->getId;
|
||||
if ( $properties->{ $prop }->{ namespace } eq $self->get( "namespace" ) ) {
|
||||
$asset->addRevision( { $prop => $newTemplate->getId } );
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
$asset->addRevision( { $prop => $newTemplate->getId, tagId => $tag->getId, status => "pending" } );
|
||||
$asset->setVersionLock;
|
||||
|
||||
# Auto-commit our revision if necessary
|
||||
# TODO: This needs to be handled automatically somehow...
|
||||
|
|
@ -1087,9 +1089,12 @@ sub www_styleWizard {
|
|||
</div>
|
||||
</body>
|
||||
</html>';
|
||||
return $self->addRevision({
|
||||
my $tag = WebGUI::VersionTag->getWorking( $self->session );
|
||||
my $newSelf = $self->addRevision({
|
||||
template=>$style
|
||||
})->www_edit;
|
||||
});
|
||||
$newSelf->setVersionLock;
|
||||
return $newSelf->www_edit;
|
||||
} else {
|
||||
$output = WebGUI::Form::formHeader($self->session,{action=>$self->getUrl}).WebGUI::Form::hidden($self->session,{name=>"func", value=>"styleWizard"});
|
||||
$output .= WebGUI::Form::hidden($self->session,{name=>"proceed", value=>"manageAssets"}) if ($form->get("proceed"));
|
||||
|
|
|
|||
|
|
@ -1423,7 +1423,9 @@ sub www_deleteFieldConfirm {
|
|||
unless $self->canEdit;
|
||||
return $self->session->privilege->locked
|
||||
unless $self->canEditIfLocked;
|
||||
my $newSelf = $self->addRevision;
|
||||
my $tag = WebGUI::VersionTag->getWorking( $self->session );
|
||||
my $newSelf = $self->addRevision({ tagId => $tag->getId, status => "pending" });
|
||||
$newSelf->setVersionLock;
|
||||
$newSelf->deleteField($self->session->form->process("fieldName"));
|
||||
$newSelf->{_mode} = 'form';
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
|
||||
|
|
@ -1450,7 +1452,9 @@ sub www_deleteTabConfirm {
|
|||
unless $self->canEdit;
|
||||
return $self->session->privilege->locked
|
||||
unless $self->canEditIfLocked;
|
||||
my $newSelf = $self->addRevision;
|
||||
my $tag = WebGUI::VersionTag->getWorking( $self->session );
|
||||
my $newSelf = $self->addRevision({ tagId => $tag->getId, status => "pending" });
|
||||
$newSelf->setVersionLock;
|
||||
$newSelf->deleteTab($self->session->form->process("tabId"));
|
||||
$newSelf->{_mode} = 'form';
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
|
||||
|
|
@ -1667,7 +1671,9 @@ sub www_editFieldSave {
|
|||
$field{isMailField} = 1;
|
||||
}
|
||||
|
||||
my $newSelf = $self->addRevision;
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
my $newSelf = $self->addRevision({ tagId => $tag->getId, status => "pending" });
|
||||
$newSelf->setVersionLock;
|
||||
if ($fieldName) {
|
||||
if ($fieldName ne $newName) {
|
||||
$newSelf->renameField($fieldName, $newName);
|
||||
|
|
@ -1923,7 +1929,9 @@ sub www_moveFieldDown {
|
|||
unless $self->canEdit;
|
||||
return $self->session->privilege->locked
|
||||
unless $self->canEditIfLocked;
|
||||
my $newSelf = $self->addRevision;
|
||||
my $tag = WebGUI::VersionTag->getWorking( $self->session );
|
||||
my $newSelf = $self->addRevision({ tagId => $tag->getId, status => "pending" });
|
||||
$newSelf->setVersionLock;
|
||||
my $fieldName = $self->session->form->process('fieldName');
|
||||
$newSelf->moveFieldDown($fieldName);
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
|
||||
|
|
@ -1983,7 +1991,9 @@ sub www_moveFieldUp {
|
|||
unless $self->canEdit;
|
||||
return $self->session->privilege->locked
|
||||
unless $self->canEditIfLocked;
|
||||
my $newSelf = $self->addRevision;
|
||||
my $tag = WebGUI::VersionTag->getWorking( $self->session );
|
||||
my $newSelf = $self->addRevision({ tagId => $tag->getId, status => "pending" });
|
||||
$newSelf->setVersionLock;
|
||||
my $fieldName = $self->session->form->process('fieldName');
|
||||
$newSelf->moveFieldUp($fieldName);
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
|
||||
|
|
@ -2044,7 +2054,9 @@ sub www_moveTabRight {
|
|||
unless $self->canEdit;
|
||||
return $self->session->privilege->locked
|
||||
unless $self->canEditIfLocked;
|
||||
my $newSelf = $self->addRevision;
|
||||
my $tag = WebGUI::VersionTag->getWorking( $self->session );
|
||||
my $newSelf = $self->addRevision({ tagId => $tag->getId, status => "pending" });
|
||||
$newSelf->setVersionLock;
|
||||
my $tabId = $self->session->form->process('tabId');
|
||||
$newSelf->moveTabRight($tabId);
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
|
||||
|
|
@ -2100,7 +2112,9 @@ sub www_moveTabLeft {
|
|||
unless $self->canEdit;
|
||||
return $self->session->privilege->locked
|
||||
unless $self->canEditIfLocked;
|
||||
my $newSelf = $self->addRevision;
|
||||
my $tag = WebGUI::VersionTag->getWorking( $self->session );
|
||||
my $newSelf = $self->addRevision({ tagId => $tag->getId, status => "pending" });
|
||||
$newSelf->setVersionLock;
|
||||
my $tabId = $self->session->form->process('tabId');
|
||||
$newSelf->moveTabLeft($tabId);
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
|
||||
|
|
|
|||
|
|
@ -771,8 +771,11 @@ sub processFileSynopsis {
|
|||
if ( $asset->synopsis ne $synopsis ) {
|
||||
my $properties = $asset->get;
|
||||
$properties->{ synopsis } = $synopsis;
|
||||
$properties->{ tagId } = $newVersionTag->getId;
|
||||
$properties->{ status } = "pending";
|
||||
|
||||
$asset->addRevision( $properties, undef, { skipAutoCommitWorkflows => 1 } );
|
||||
my $newRev = $asset->addRevision( $properties );
|
||||
$newRev->setVersionLock;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1440,7 +1443,9 @@ sub www_edit {
|
|||
|
||||
if ( ! Exception::Class->caught() ) {
|
||||
# Add revision and create a new version tag by doing so
|
||||
my $newRevision = $asset->addRevision;
|
||||
my $tag = WebGUI::VersionTag->create( $session, { workflowId => $asset->getAutoCommitWorkflowId } );
|
||||
my $newRevision = $asset->addRevision({ tagId => $tag->getId, status => "pending" });
|
||||
$newRevision->setVersionLock;
|
||||
# Rotate photo (i.e. all attached image files) by 90° CCW
|
||||
$newRevision->rotate(-90);
|
||||
# Auto-commit version tag
|
||||
|
|
@ -1458,7 +1463,9 @@ sub www_edit {
|
|||
|
||||
if ( Exception::Class->caught() ) {
|
||||
# Add revision and create a new version tag by doing so
|
||||
my $newRevision = $asset->addRevision;
|
||||
my $tag = WebGUI::VersionTag->create( $session, { workflowId => $asset->getAutoCommitWorkflowId } );
|
||||
my $newRevision = $asset->addRevision({ tagId => $tag->getId, status => "pending" });
|
||||
$newRevision->setVersionLock;
|
||||
# Rotate photo (i.e. all attached image files) by 90° CW
|
||||
$newRevision->rotate(90);
|
||||
# Auto-commit version tag
|
||||
|
|
|
|||
|
|
@ -322,9 +322,11 @@ a new asset revision.
|
|||
sub www_setContentPositions {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless ($self->canEdit);
|
||||
$self->addRevision({
|
||||
my $tag = WebGUI::VersionTag->getWorking( $self->session );
|
||||
my $newSelf = $self->addRevision({
|
||||
contentPositions=>$self->session->form->process("map")
|
||||
});
|
||||
$newSelf->setVersionLock;
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
|
||||
return "Map set: ".$self->session->form->process("map");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -554,12 +554,20 @@ sub www_ajaxEditPointSave {
|
|||
unless $asset && $asset->canEdit;
|
||||
$asset = $asset->addRevision;
|
||||
}
|
||||
|
||||
|
||||
my $errors = $asset->processAjaxEditForm;
|
||||
|
||||
# Commit!
|
||||
if ( $asset->getAutoCommitWorkflowId ) {
|
||||
if ( $self->hasBeenCommitted) {
|
||||
my $tag = WebGUI::VersionTag->create( $session, {
|
||||
workflowId => $asset->getAutoCommitWorkflowId,
|
||||
} );
|
||||
$asset->update({
|
||||
tagId => $tag->getId,
|
||||
status => "pending",
|
||||
});
|
||||
$asset->setVersionLock;
|
||||
$asset->requestAutoCommit;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -837,18 +837,16 @@ sub submitObjectEdit {
|
|||
. $self->revisionDate );
|
||||
|
||||
# New revision should be created and then committed automatically
|
||||
my $oldVersionTag = WebGUI::VersionTag->getWorking($session, 'noCreate');
|
||||
my $newVersionTag = WebGUI::VersionTag->create($session, { workflowId => 'pbworkflow00000000003', });
|
||||
$newVersionTag->setWorking;
|
||||
|
||||
# Create the new revision
|
||||
$survey = $self->addRevision;
|
||||
$survey = $self->addRevision({
|
||||
tagId => $newVersionTag->getId,
|
||||
status => "pending",
|
||||
});
|
||||
|
||||
$newVersionTag->commit();
|
||||
$survey = $survey->cloneFromDb;
|
||||
|
||||
#Restore the old one, if it exists
|
||||
$oldVersionTag->setWorking() if $oldVersionTag;
|
||||
}
|
||||
|
||||
# See if any special actions were requested..
|
||||
|
|
|
|||
|
|
@ -353,6 +353,7 @@ sub www_editBranchSave {
|
|||
my %data;
|
||||
my $pb = WebGUI::ProgressBar->new($session);
|
||||
my $i18n = WebGUI::International->new($session, 'Asset');
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
$pb->start($i18n->get('edit branch'), $session->url->extras('adminConsole/assets.gif'));
|
||||
$pb->update($i18n->get('Processing form data'));
|
||||
$data{isHidden} = $form->yesNo("isHidden") if ($form->yesNo("change_isHidden"));
|
||||
|
|
@ -428,10 +429,11 @@ sub www_editBranchSave {
|
|||
my $revision;
|
||||
if (scalar %$newData > 0) {
|
||||
$revision = $descendant->addRevision(
|
||||
$newData,
|
||||
{ %$newData, tagId => $tag->getId, status => "pending" },
|
||||
undef,
|
||||
{skipAutoCommitWorkflows => 1, skipNotification => 1},
|
||||
);
|
||||
$revision->setVersionLock;
|
||||
}
|
||||
else {
|
||||
$revision = $descendant;
|
||||
|
|
|
|||
|
|
@ -319,6 +319,7 @@ sub www_editBranchSave {
|
|||
my %data;
|
||||
my $pb = WebGUI::ProgressBar->new($session);
|
||||
my $i18n = WebGUI::International->new($session, 'Asset');
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
$data{isHidden} = $form->yesNo("isHidden") if ($form->yesNo("change_isHidden"));
|
||||
$data{newWindow} = $form->yesNo("newWindow") if ($form->yesNo("change_newWindow"));
|
||||
$data{encryptPage} = $form->yesNo("encryptPage") if ($form->yesNo("change_encryptPage"));
|
||||
|
|
@ -401,10 +402,11 @@ sub www_editBranchSave {
|
|||
my $revision;
|
||||
if (scalar %$newData > 0) {
|
||||
$revision = $descendant->addRevision(
|
||||
$newData,
|
||||
{ %$newData, tagId => $tag->getId, status => "pending" },
|
||||
undef,
|
||||
{skipAutoCommitWorkflows => 1, skipNotification => 1},
|
||||
);
|
||||
$revision->setVersionLock;
|
||||
}
|
||||
else {
|
||||
$revision = $descendant;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,12 @@ sub process {
|
|||
return { error => sprintf $i18n->get('already locked'), $asset->getTitle};
|
||||
}
|
||||
|
||||
$asset = $asset->addRevision;
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
$asset = $asset->addRevision({
|
||||
tagId => $tag->getId,
|
||||
status => "pending",
|
||||
});
|
||||
$asset->setVersionLock;
|
||||
return {
|
||||
message => sprintf($i18n->get('locked asset'), $asset->getTitle),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -265,6 +265,7 @@ sub importPackage {
|
|||
if $storage->getErrorCount;
|
||||
my $package = undef; # The asset package
|
||||
my $log = $self->session->log;
|
||||
my $tag = WebGUI::VersionTag->getWorking( $self->session );
|
||||
|
||||
# The debug output for long requests would be too long, and we'd have to
|
||||
# keep it all in memory.
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ sub addRevision {
|
|||
|
||||
# Set some defaults
|
||||
$mergedProperties{ revisedBy } ||= $session->user->userId;
|
||||
$mergedProperties{ status } ||= "approved";
|
||||
|
||||
#Instantiate new revision and fill with real data
|
||||
my $newVersion = WebGUI::Asset->newById($session, $self->getId, $now);
|
||||
|
|
@ -550,7 +549,9 @@ This is the same as doing an www_editSave without changing anything. It's here s
|
|||
sub www_lock {
|
||||
my $self = shift;
|
||||
if (!$self->isLocked && $self->canEdit) {
|
||||
$self = $self->addRevision;
|
||||
my $tag = WebGUI::VersionTag->getWorking( $self->session );
|
||||
$self = $self->addRevision({ tagId => $tag->getId, status => "pending" });
|
||||
$self->setVersionLock;
|
||||
}
|
||||
if ($self->session->form->process("proceed") eq "manageAssets") {
|
||||
$self->session->asset($self->getParent);
|
||||
|
|
|
|||
|
|
@ -60,16 +60,18 @@ $session->config->addToHash('adminConsole', 'test2', {
|
|||
} );
|
||||
|
||||
# Add some assets
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
my $snip = $import->addChild( {
|
||||
className => 'WebGUI::Asset::Snippet',
|
||||
title => 'test',
|
||||
groupIdEdit => '3',
|
||||
synopsis => "aReallyLongWordToGetIndexed",
|
||||
keywords => "AKeywordToGetIndexed",
|
||||
tagId => $tag->getId,
|
||||
status => "pending",
|
||||
} );
|
||||
|
||||
# Commit the tag
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
$tag->commit;
|
||||
addToCleanup( $tag );
|
||||
|
||||
|
|
|
|||
|
|
@ -304,10 +304,6 @@ my $session = WebGUI::Test->session;
|
|||
is $revAsset->revisionDate, $now, 'revisionDate set correctly on new revision';
|
||||
is $revAsset->title, 'test title 43', 'data fetch from database correct';
|
||||
is $revAsset->revisedBy, $session->user->userId, 'revisedBy is current session user';
|
||||
is $revAsset->tagId, $tag->getId, 'tagId is current working tagId';
|
||||
ok $revAsset->isLocked, 'new revision is locked';
|
||||
is $revAsset->isLockedBy, '7', 'locked by userId 7';
|
||||
is $revAssetDb->isLockedBy, '7', 'database jives with asset data';
|
||||
my $count = $session->db->quickScalar('SELECT COUNT(*) from assetData where assetId=?',[$testId2]);
|
||||
is $count, 2, 'two records in the database';
|
||||
addToCleanup($tag);
|
||||
|
|
|
|||
135
t/Asset/Asset.t
135
t/Asset/Asset.t
|
|
@ -98,12 +98,8 @@ $properties = {
|
|||
groupIdView => 7,
|
||||
};
|
||||
|
||||
my $versionTag2 = WebGUI::VersionTag->getWorking($session);
|
||||
addToCleanup($versionTag2);
|
||||
|
||||
my $canEditAsset = $rootAsset->addChild($properties, $properties->{id});
|
||||
|
||||
$versionTag2->commit;
|
||||
addToCleanup( $canEditAsset );
|
||||
$properties = {}; ##Clear out the hash so that it doesn't leak later by accident.
|
||||
|
||||
my $canEditMaker = WebGUI::Test::Maker::Permission->new();
|
||||
|
|
@ -114,8 +110,6 @@ $canEditMaker->prepare({
|
|||
'fail' => [1, $testUsers{'regular user'}, ],
|
||||
});
|
||||
|
||||
my $versionTag3 = WebGUI::VersionTag->getWorking($session);
|
||||
addToCleanup($versionTag3);
|
||||
$properties = {
|
||||
# '1234567890123456789012'
|
||||
id => 'canViewAsset0000000010',
|
||||
|
|
@ -129,8 +123,7 @@ $properties = {
|
|||
|
||||
|
||||
my $canViewAsset = $rootAsset->addChild($properties, $properties->{id});
|
||||
|
||||
$versionTag3->commit;
|
||||
addToCleanup( $canViewAsset );
|
||||
$properties = {}; ##Clear out the hash so that it doesn't leak later by accident.
|
||||
|
||||
my $canViewMaker = WebGUI::Test::Maker::Permission->new();
|
||||
|
|
@ -148,7 +141,7 @@ $canViewMaker->prepare(
|
|||
},
|
||||
);
|
||||
|
||||
plan tests => 121
|
||||
plan tests => 113
|
||||
+ 2*scalar(@getTitleTests) #same tests used for getTitle and getMenuTitle
|
||||
;
|
||||
|
||||
|
|
@ -345,10 +338,6 @@ is($importNode->addEditLabel, $i18n->get('add').' '.$importNode->getName, 'addEd
|
|||
#
|
||||
################################################################
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
addToCleanup($versionTag);
|
||||
$versionTag->set({name=>"Asset tests"});
|
||||
|
||||
my $properties = {
|
||||
# '1234567890123456789012'
|
||||
id => 'fixUrlAsset00000000012',
|
||||
|
|
@ -358,18 +347,21 @@ my $properties = {
|
|||
};
|
||||
|
||||
my $fixUrlAsset = $defaultAsset->addChild($properties, $properties->{id});
|
||||
addToCleanup( $fixUrlAsset );
|
||||
|
||||
# '1234567890123456789012'
|
||||
$properties->{id} = 'fixUrlAsset00000000013';
|
||||
$properties->{url} = 'fixUrlFolderURL9';
|
||||
|
||||
my $fixUrlAsset2 = $defaultAsset->addChild($properties, $properties->{id});
|
||||
addToCleanup( $fixUrlAsset2 );
|
||||
|
||||
# '1234567890123456789012'
|
||||
$properties->{id} = 'fixUrlAsset00000000014';
|
||||
$properties->{url} = 'fixUrlFolderURL00';
|
||||
|
||||
my $fixUrlAsset3 = $defaultAsset->addChild($properties, $properties->{id});
|
||||
addToCleanup( $fixUrlAsset3 );
|
||||
|
||||
# '1234567890123456789012'
|
||||
$properties->{id} = 'fixUrlAsset00000000015';
|
||||
|
|
@ -377,6 +369,7 @@ $properties->{url} = 'fixUrlFolderURL100';
|
|||
|
||||
my $fixUrlAsset4 = $defaultAsset->addChild($properties, $properties->{id});
|
||||
is($fixUrlAsset4->get('url'), 'fixurlfolderurl100', 'asset setup correctly for 100->101 test');
|
||||
addToCleanup( $fixUrlAsset4 );
|
||||
|
||||
delete $properties->{url};
|
||||
# '1234567890123456789012'
|
||||
|
|
@ -384,6 +377,7 @@ $properties->{id} = 'fixUrlAsset00000000016';
|
|||
$properties->{menuTitle} = 'fix url folder url autogenerated';
|
||||
|
||||
my $fixUrlAsset5 = $defaultAsset->addChild($properties, $properties->{id});
|
||||
addToCleanup( $fixUrlAsset5 );
|
||||
|
||||
my $properties2 = {
|
||||
# '1234567890123456789012'
|
||||
|
|
@ -394,8 +388,7 @@ my $properties2 = {
|
|||
};
|
||||
|
||||
my $fixTitleAsset = $defaultAsset->addChild($properties2, $properties2->{id});
|
||||
##Commit this asset right away
|
||||
$fixTitleAsset->commit;
|
||||
addToCleanup( $fixTitleAsset );
|
||||
|
||||
$properties2 = {
|
||||
# '1234567890123456789012'
|
||||
|
|
@ -406,9 +399,7 @@ $properties2 = {
|
|||
};
|
||||
|
||||
my $getTitleAsset = $defaultAsset->addChild($properties2, $properties2->{id});
|
||||
$getTitleAsset->commit;
|
||||
|
||||
$versionTag->commit;
|
||||
addToCleanup( $getTitleAsset );
|
||||
|
||||
$session->setting->set('urlExtension', undef);
|
||||
|
||||
|
|
@ -623,10 +614,8 @@ 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});
|
||||
my $pTag = WebGUI::VersionTag->getWorking($session);
|
||||
$pTag->commit;
|
||||
addToCleanup($pTag);
|
||||
my $product4 = $node->addChild({ className => 'WebGUI::Asset::Sku::Product'}, undef, undef, { skipAutoCommitWorkflows => 1});
|
||||
addToCleanup($product1, $product2, $product3);
|
||||
my $product4 = $node->addChild({ className => 'WebGUI::Asset::Sku::Product', status => "pending"}, undef, undef, { skipAutoCommitWorkflows => 1});
|
||||
addToCleanup($product4);
|
||||
|
||||
my $getAProduct = WebGUI::Asset::Sku::Product->getIsa($session);
|
||||
|
|
@ -669,10 +658,6 @@ $product4->purge;
|
|||
################################################################
|
||||
note "inheritUrlFromParent";
|
||||
|
||||
my $versionTag4 = WebGUI::VersionTag->getWorking($session);
|
||||
addToCleanup($versionTag4);
|
||||
$versionTag4->set( { name => 'inheritUrlFromParent tests' } );
|
||||
|
||||
$properties = {
|
||||
# '1234567890123456789012'
|
||||
id => 'inheritUrlFromParent01',
|
||||
|
|
@ -682,6 +667,7 @@ $properties = {
|
|||
};
|
||||
|
||||
my $iufpAsset = $defaultAsset->addChild($properties, $properties->{id});
|
||||
addToCleanup( $iufpAsset );
|
||||
$iufpAsset->commit;
|
||||
|
||||
$properties2 = {
|
||||
|
|
@ -693,6 +679,7 @@ $properties2 = {
|
|||
};
|
||||
|
||||
my $iufpAsset2 = $iufpAsset->addChild($properties2, $properties2->{id});
|
||||
addToCleanup( $iufpAsset2 );
|
||||
$iufpAsset2->update( { inheritUrlFromParent => 1 } );
|
||||
is $iufpAsset2->inheritUrlFromParent, 1, 'inheritUrlFromParent set';
|
||||
$iufpAsset2->commit;
|
||||
|
|
@ -708,6 +695,7 @@ my $properties2a = {
|
|||
};
|
||||
|
||||
my $iufpAsset2a = $iufpAsset->addChild($properties2a, $properties2a->{id});
|
||||
addToCleanup( $iufpAsset2a );
|
||||
$iufpAsset2a->commit;
|
||||
is($iufpAsset2a->url, 'inheriturlfromparent01/inheriturlfromparent2a', '... works when created with the property');
|
||||
|
||||
|
|
@ -729,6 +717,7 @@ my $properties3 = {
|
|||
url => 'inheriturlfromparent03',
|
||||
};
|
||||
my $iufpAsset3 = $iufpAsset2->addChild($properties3, $properties3->{id});
|
||||
addToCleanup( $iufpAsset3 );
|
||||
$iufpAsset3->commit;
|
||||
$iufpAsset2->update( { inheritUrlFromParent => 1 } );
|
||||
$iufpAsset2->commit;
|
||||
|
|
@ -740,94 +729,19 @@ $iufpAsset2->update({url => 'iufp2'});
|
|||
is($iufpAsset2->url, 'inheriturlfromparent01/iufp2', '... update works propertly when iUFP is not passed');
|
||||
|
||||
|
||||
################################################################
|
||||
#
|
||||
# addRevision to uncommitted child of uncommitted parent
|
||||
#
|
||||
################################################################
|
||||
|
||||
my $versionTag5 = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag5->set( { name => 'move revision of uncommitted child to uncommitted parent tests vt1' } );
|
||||
|
||||
$properties = {
|
||||
|
||||
# '1234567890123456789012'
|
||||
id => 'moveVersionToParent_01',
|
||||
title => 'moveVersionToParent_01',
|
||||
className => 'WebGUI::Asset::Wobject::Layout',
|
||||
url => 'moveVersionToParent_01',
|
||||
};
|
||||
|
||||
my $parentAsset = $defaultAsset->addChild( $properties, $properties->{id}, undef, { skipAutoCommitWorkflows => 1 } );
|
||||
my $parentVersionTag = WebGUI::VersionTag->new($session, $parentAsset->tagId);
|
||||
is( $parentVersionTag->get('isCommitted'), 0, 'built non-committed parent asset' );
|
||||
|
||||
|
||||
my $versionTag6 = WebGUI::VersionTag->create( $session, {} );
|
||||
$versionTag6->set( { name => 'move revision of uncommitted child to uncommitted parent tests vt2' } );
|
||||
$versionTag6->setWorking;
|
||||
|
||||
$properties2 = {
|
||||
|
||||
# '1234567890123456789012'
|
||||
id => 'moveVersionToParent_03',
|
||||
title => 'moveVersionToParent_03',
|
||||
className => 'WebGUI::Asset::Wobject::Layout',
|
||||
url => 'moveVersionToParent_03',
|
||||
};
|
||||
|
||||
my $childAsset = $parentAsset->addChild(
|
||||
$properties2, $properties2->{id},
|
||||
time(),
|
||||
{ skipAutoCommitWorkflows => 1 }
|
||||
);
|
||||
my $testAsset = WebGUI::Asset->newPending( $session, $childAsset->parentId );
|
||||
my $testVersionTag = WebGUI::VersionTag->new( $session, $testAsset->tagId );
|
||||
|
||||
my $childVersionTag;
|
||||
$childVersionTag = WebGUI::VersionTag->new( $session, $childAsset->tagId );
|
||||
is( $childVersionTag->get('isCommitted'), 0, 'built non-committed child asset' );
|
||||
|
||||
is( $testAsset->tagId,
|
||||
$childAsset->tagId,
|
||||
'uncommitted parent asset and uncommitted child asset have same version tag at addChild'
|
||||
);
|
||||
|
||||
$properties2 = {
|
||||
|
||||
# '1234567890123456789012'
|
||||
id => 'moveVersionToParent_03',
|
||||
title => 'moveVersionToParent_03a',
|
||||
className => 'WebGUI::Asset::Wobject::Layout',
|
||||
url => 'moveVersionToParent_03a',
|
||||
};
|
||||
sleep 2;
|
||||
$childAsset->addRevision( $properties2, time(), { skipAutoCommitWorkflows => 1 } );
|
||||
|
||||
is( $parentVersionTag->get('isCommitted'), 0, 'confimr non-committed parent asset after revision' );
|
||||
is( $childVersionTag->get('isCommitted'), 0, 'confirm non-committed child asset after revision' );
|
||||
|
||||
is( $testAsset->get('tagId'),
|
||||
$childAsset->get('tagId'),
|
||||
'uncommitted parent asset and uncommitted child asset have same version tag after addRevision'
|
||||
);
|
||||
|
||||
eval { $testVersionTag->commit; };
|
||||
|
||||
$session->log->warn('parent asset is now committed');
|
||||
is( $testVersionTag->get('isCommitted'), 1, 'parent asset is now committed' );
|
||||
|
||||
$childVersionTag = WebGUI::VersionTag->new( $session, $childAsset->get('tagId') );
|
||||
is( $childVersionTag->get('isCommitted'), 1, 'child asset is now committed' );
|
||||
|
||||
################################################################
|
||||
#
|
||||
# cloneFromDb
|
||||
#
|
||||
################################################################
|
||||
|
||||
my $assetToCommit = $defaultAsset->addChild({ className => 'WebGUI::Asset::Snippet', title => 'Snippet to commit and clone from db', });
|
||||
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,
|
||||
});
|
||||
addToCleanup($cloneTag);
|
||||
$cloneTag->commit;
|
||||
is($assetToCommit->get('status'), 'pending', 'cloneFromDb: local asset is still pending');
|
||||
|
|
@ -847,10 +761,7 @@ my $trashedAsset = $defaultAsset->addChild({
|
|||
my $clippedAsset = $defaultAsset->addChild({
|
||||
className => 'WebGUI::Asset::Snippet', title => 'Clippy',
|
||||
});
|
||||
|
||||
my $checkTag = WebGUI::VersionTag->getWorking($session);
|
||||
$checkTag->commit;
|
||||
addToCleanup($checkTag);
|
||||
addToCleanup( $trashedAsset, $clippedAsset );
|
||||
$trashedAsset = $trashedAsset->cloneFromDb;
|
||||
$clippedAsset = $clippedAsset->cloneFromDb;
|
||||
$trashedAsset->trash;
|
||||
|
|
|
|||
|
|
@ -134,7 +134,11 @@ $tag->setWorking;
|
|||
WebGUI::Test->addToCleanup($tag);
|
||||
|
||||
my $tempspace = WebGUI::Asset->getTempspace($session);
|
||||
my $folder = {className => 'WebGUI::Asset::Wobject::Folder'};
|
||||
my $folder = {
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
tagId => $tag->getId,
|
||||
status => "pending",
|
||||
};
|
||||
my $root = $tempspace->addChild($folder);
|
||||
my $child = $root->addChild($folder);
|
||||
my $grandchild = $child->addChild($folder);
|
||||
|
|
@ -175,13 +179,17 @@ my $versionTag2 = WebGUI::VersionTag->getWorking($session);
|
|||
WebGUI::Test->addToCleanup($versionTag2);
|
||||
|
||||
my $page = $tempspace->addChild({
|
||||
className => 'WebGUI::Asset::Wobject::Layout',
|
||||
title => 'Parent asset',
|
||||
className => 'WebGUI::Asset::Wobject::Layout',
|
||||
title => 'Parent asset',
|
||||
tagId => $versionTag2->getId,
|
||||
status => "pending",
|
||||
});
|
||||
|
||||
my $shortcut = $tempspace->addChild({
|
||||
className => 'WebGUI::Asset::Shortcut',
|
||||
shortcutToAssetId => $page->getId,
|
||||
className => 'WebGUI::Asset::Shortcut',
|
||||
shortcutToAssetId => $page->getId,
|
||||
tagId => $versionTag2->getId,
|
||||
status => "pending",
|
||||
});
|
||||
|
||||
$versionTag2->commit;
|
||||
|
|
|
|||
|
|
@ -170,16 +170,22 @@ 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;
|
||||
|
||||
|
|
@ -310,6 +316,8 @@ 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');
|
||||
|
|
@ -329,6 +337,8 @@ $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({
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use WebGUI::Session;
|
|||
use WebGUI::User;
|
||||
|
||||
use WebGUI::Asset;
|
||||
use Test::More tests => 109; # increment this value for each test you create
|
||||
use Test::More tests => 108; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
use Test::Exception;
|
||||
use Data::Dumper;
|
||||
|
|
@ -40,6 +40,8 @@ my $topFolder = $root->addChild({
|
|||
menuTitle => 'topFolderMenuTitle',
|
||||
groupIdEdit => 3,
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
tagId => $versionTag->getId,
|
||||
status => "pending",
|
||||
});
|
||||
|
||||
my $folder = $topFolder->addChild({
|
||||
|
|
@ -48,6 +50,8 @@ my $folder = $topFolder->addChild({
|
|||
menuTitle => 'folderMenuTitle',
|
||||
groupIdEdit => 3,
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
tagId => $versionTag->getId,
|
||||
status => "pending",
|
||||
});
|
||||
|
||||
my $folder2 = $topFolder->addChild({
|
||||
|
|
@ -55,6 +59,8 @@ 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');
|
||||
|
|
@ -71,6 +77,8 @@ foreach my $snipNum (0..6) {
|
|||
title => "Snippet $snipNum",
|
||||
menuTitle => $snipNum,
|
||||
url => 'snippet'.$snipNum,
|
||||
tagId => $versionTag->getId,
|
||||
status => "pending",
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -80,6 +88,8 @@ my $snippet2 = $folder2->addChild( {
|
|||
ownerUserId => $editor->userId, #For coverage on addChild properties
|
||||
title => "Snippet2 0",
|
||||
menuTitle => 0,
|
||||
tagId => $versionTag->getId,
|
||||
status => "pending",
|
||||
});
|
||||
|
||||
$versionTag->commit;
|
||||
|
|
@ -665,6 +675,8 @@ WebGUI::Test->interceptLogging( sub {
|
|||
ownerUserId => 3, #For coverage on addChild properties
|
||||
title => "Deep Snippet $_",
|
||||
menuTitle => "Deep Snip $_",
|
||||
tagId => $vTag2->getId,
|
||||
status => "pending",
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -674,26 +686,6 @@ WebGUI::Test->interceptLogging( sub {
|
|||
like($log_data->{warn}, qr/Adding it as a sibling instead/, 'addChild logged a warning about deep assets');
|
||||
});
|
||||
|
||||
{
|
||||
my $tag = WebGUI::VersionTag->getWorking($session);
|
||||
addToCleanup($tag);
|
||||
my $uncommittedParent = $root->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Layout",
|
||||
groupIdView => 7,
|
||||
ownerUserId => 3,
|
||||
title => "Uncommitted Parent",
|
||||
});
|
||||
$tag->leaveTag;
|
||||
my $parent = WebGUI::Asset->newPending($session, $uncommittedParent->getId);
|
||||
my $floater = $parent->addChild({
|
||||
className => "WebGUI::Asset::Snippet",
|
||||
groupIdView => 7,
|
||||
ownerUserId => 3, #For coverage on addChild properties
|
||||
title => "Child of uncommitted parent",
|
||||
});
|
||||
is $parent->get('tagId'), $floater->get('tagId'), 'addChild: with uncommitted parent, adds child and puts it into the same tag as the parent';
|
||||
}
|
||||
|
||||
TODO: {
|
||||
local $TODO = "Tests to make later";
|
||||
ok(0, 'addChild');
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ my $folder = $root->addChild({
|
|||
menuTitle => 'folderMenuTitle',
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
isPackage => 1,
|
||||
tagId => $versionTag->getId,
|
||||
status => "pending",
|
||||
}, undef, $time);
|
||||
|
||||
my $targetFolder = $root->addChild({
|
||||
|
|
@ -47,6 +49,8 @@ my $targetFolder = $root->addChild({
|
|||
title => 'Target Folder',
|
||||
menuTitle => 'Target folderMenuTitle',
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
tagId => $versionTag->getId,
|
||||
status => "pending",
|
||||
});
|
||||
|
||||
my $subSnippet = $folder->addChild({
|
||||
|
|
@ -55,6 +59,8 @@ 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({
|
||||
|
|
@ -63,6 +69,8 @@ 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;
|
||||
|
|
@ -79,11 +87,15 @@ $versionTag->commit;
|
|||
my $storage = $snippet->exportPackage();
|
||||
isa_ok($storage, 'WebGUI::Storage', 'exportPackage returns a WebGUI::Storage object');
|
||||
|
||||
my $snippetRev = $snippet->addRevision({ snippet => 'Only upgrade existing data if revisionDate is newer' });
|
||||
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');
|
||||
|
||||
my $vt2 = WebGUI::VersionTag->getWorking($session);
|
||||
$vt2->commit;
|
||||
WebGUI::Test->addToCleanup($vt2);
|
||||
|
||||
|
|
@ -103,10 +115,9 @@ is(scalar @{ $deployedFolderChildren }, 1, 'deployed package folder still has 1
|
|||
isa_ok($deployedFolderChildren->[0] , 'WebGUI::Asset::Snippet', 'deployed child is a Snippet');
|
||||
|
||||
##Unset isPackage in this versionTag for the next tests
|
||||
$folder->addRevision({isPackage => 0});
|
||||
|
||||
my $newVersionTag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($newVersionTag);
|
||||
$folder->addRevision({isPackage => 0, tagId => $newVersionTag->getId, status => "pending", });
|
||||
$newVersionTag->commit;
|
||||
|
||||
my $newFolder = WebGUI::Asset->newById($session, $folder->getId);
|
||||
|
|
@ -137,6 +148,8 @@ 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;
|
||||
|
|
|
|||
|
|
@ -24,9 +24,16 @@ my $versionTag = WebGUI::VersionTag->getWorking($session);
|
|||
$versionTag->set({name=>"Adding Calendar for Event Asset Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $defaultAsset = WebGUI::Asset->getDefault($session);
|
||||
my $cal = $defaultAsset->addChild({className=>'WebGUI::Asset::Wobject::Calendar'});
|
||||
my $cal = $defaultAsset->addChild({
|
||||
className=>'WebGUI::Asset::Wobject::Calendar',
|
||||
tagId => $versionTag->getId,
|
||||
status => "pending",
|
||||
});
|
||||
$versionTag->commit;
|
||||
|
||||
my $versionTag2 = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTag2);
|
||||
|
||||
my $properties = {
|
||||
# '1234567890123456789012'
|
||||
id => 'EventAssetTest00000001',
|
||||
|
|
@ -39,6 +46,8 @@ my $properties = {
|
|||
endTime => '03:00:00',
|
||||
timeZone => 'America/Chicago',
|
||||
location => 'Madison, Wisconsin',
|
||||
tagId => $versionTag->getId,
|
||||
status => "pending",
|
||||
};
|
||||
|
||||
my $event = $cal->addChild($properties, $properties->{id});
|
||||
|
|
@ -125,9 +134,6 @@ my $event6a = $event6->addRevision({ title => 'Event with storage', }, undef, {
|
|||
ok($session->id->valid($event6a->get('storageId')), 'addRevision gives the new revision a valid storageId');
|
||||
isnt($event6a->get('storageId'), $event6->get('storageId'), '... and it is different from the previous revision');
|
||||
|
||||
my $versionTag2 = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTag2);
|
||||
|
||||
my $event7 = $cal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
startDate => '2000-08-31',
|
||||
|
|
|
|||
|
|
@ -79,9 +79,11 @@ my $instance = WebGUI::Workflow::Instance->create(
|
|||
);
|
||||
|
||||
|
||||
my $count = 0;
|
||||
while (my $status = $instance->run ne 'complete') {
|
||||
note $status;
|
||||
$instance->run;
|
||||
last if $count++ > 30;
|
||||
}
|
||||
|
||||
my $sql = q{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue