Test::Class asset tests fixed for addRevision
This commit is contained in:
parent
f0df8b720b
commit
0fd78da778
1 changed files with 12 additions and 19 deletions
|
|
@ -106,8 +106,10 @@ sub getAnchoredAsset {
|
||||||
my @parents = $test->getMyParents;
|
my @parents = $test->getMyParents;
|
||||||
my $asset = $parents[-1]->addChild({
|
my $asset = $parents[-1]->addChild({
|
||||||
className => $test->class,
|
className => $test->class,
|
||||||
|
status => "pending",
|
||||||
|
tagId => $tag->getId,
|
||||||
$test->constructorExtras($session),
|
$test->constructorExtras($session),
|
||||||
}, undef, undef, {skipNotification => 1, skipAutoCommitWorkflows => 1,});
|
}, undef, undef, {skipNotification => 1});
|
||||||
# warn "XXX getAnchoredAsset: created new asset of Id: " . $asset->getId . ' of type: ' . ref $asset;
|
# warn "XXX getAnchoredAsset: created new asset of Id: " . $asset->getId . ' of type: ' . ref $asset;
|
||||||
$tag->commit;
|
$tag->commit;
|
||||||
foreach my $a ($asset, @parents) {
|
foreach my $a ($asset, @parents) {
|
||||||
|
|
@ -125,12 +127,18 @@ sub getMyParents {
|
||||||
my $default = WebGUI::Asset->getDefault($session);
|
my $default = WebGUI::Asset->getDefault($session);
|
||||||
push @parents, $default;
|
push @parents, $default;
|
||||||
my $parent = $default;
|
my $parent = $default;
|
||||||
|
my $tag = WebGUI::VersionTag->getWorking($session);
|
||||||
foreach my $parent_class (@{ $parent_classes }) {
|
foreach my $parent_class (@{ $parent_classes }) {
|
||||||
my $new_parent = $parent->addChild(
|
my $new_parent = $parent->addChild(
|
||||||
{className => $parent_class, $test->constructorExtras($session), },
|
{
|
||||||
|
className => $parent_class,
|
||||||
|
status => "pending",
|
||||||
|
tagId => $tag->getId,
|
||||||
|
$test->constructorExtras($session),
|
||||||
|
},
|
||||||
undef,
|
undef,
|
||||||
undef,
|
undef,
|
||||||
{skipNotification => 1, skipAutoCommitWorkflows => 1,},
|
{skipNotification => 1,},
|
||||||
);
|
);
|
||||||
push @parents, $new_parent;
|
push @parents, $new_parent;
|
||||||
$parent = $new_parent;
|
$parent = $new_parent;
|
||||||
|
|
@ -461,27 +469,12 @@ sub t_10_addRevision : Tests {
|
||||||
my $newRevision = $asset->addRevision(
|
my $newRevision = $asset->addRevision(
|
||||||
{ title => "Newly Revised Title" },
|
{ title => "Newly Revised Title" },
|
||||||
$asset->revisionDate+2,
|
$asset->revisionDate+2,
|
||||||
{
|
|
||||||
skipAutoCommitWorkflows => 1,
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
isa_ok( $newRevision, Scalar::Util::blessed( $asset ), "addRevision returns new revision of asset object" );
|
isa_ok( $newRevision, Scalar::Util::blessed( $asset ), "addRevision returns new revision of asset object" );
|
||||||
is( $newRevision->title, "Newly Revised Title", "properties set correctly" );
|
is( $newRevision->title, "Newly Revised Title", "properties set correctly" );
|
||||||
is( $newRevision->revisionDate, $asset->revisionDate+2, 'revisionDate set correctly' );
|
is( $newRevision->revisionDate, $asset->revisionDate+2, 'revisionDate set correctly' );
|
||||||
is( $newRevision->tagId, $tag->getId, "Added to existing working tag" );
|
|
||||||
$newRevision->purgeRevision;
|
$newRevision->purgeRevision;
|
||||||
|
|
||||||
# Test autocommit
|
|
||||||
if ( $asset->getAutoCommitWorkflowId ) {
|
|
||||||
$tag->commit;
|
|
||||||
$newRevision = $asset->addRevision( { title => 'Auto Committed 2!' }, $asset->revisionDate + 8 );
|
|
||||||
is( $newRevision->title, 'Auto Committed 2!', 'properties set correctly' );
|
|
||||||
isnt( $newRevision->tagId, $tag->getId, 'Not Added to existing working tag because parent committed' );
|
|
||||||
ok( my $newTag = WebGUI::VersionTag->new( $session, $newRevision->tagId ), 'tag exists' );
|
|
||||||
$newRevision->purgeRevision;
|
|
||||||
$newTag->rollback;
|
|
||||||
}
|
|
||||||
|
|
||||||
debug($@);
|
debug($@);
|
||||||
undef $@;
|
undef $@;
|
||||||
}
|
}
|
||||||
|
|
@ -570,7 +563,7 @@ sub t_20_www_editSave : Tests {
|
||||||
my $oldGroupId = $asset->groupIdEdit;
|
my $oldGroupId = $asset->groupIdEdit;
|
||||||
$asset->groupIdEdit( 7 ); # Everybody! Everybody!
|
$asset->groupIdEdit( 7 ); # Everybody! Everybody!
|
||||||
|
|
||||||
$asset->commmit;
|
$asset->commit;
|
||||||
$tag->setWorking;
|
$tag->setWorking;
|
||||||
sleep 2; # XXXX Todo -- investigate whether this is actually fixing duplicate commit problems
|
sleep 2; # XXXX Todo -- investigate whether this is actually fixing duplicate commit problems
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue