adding version tag commits. all tests pass

This commit is contained in:
Colin Kuskie 2007-12-20 00:24:38 +00:00
parent c839ab3c0a
commit 15c3c2e8f6
2 changed files with 45 additions and 39 deletions

View file

@ -21,32 +21,32 @@ use Test::More;
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Init # Init
my $session = WebGUI::Test->session; my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session); my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session); my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Photo Test"}); $versionTag->set({name=>"Photo Test"});
print "hi";
my $gallery my $gallery
= $node->addChild({ = $node->addChild({
className => "WebGUI::Asset::Wobject::Gallery", className => "WebGUI::Asset::Wobject::Gallery",
},
undef,
undef,
{
skipAutoCommitWorkflows => 1,
}); });
my $album my $album
= $gallery->addChild({ = $gallery->addChild({
className => "WebGUI::Asset::Wobject::GalleryAlbum", className => "WebGUI::Asset::Wobject::GalleryAlbum",
},
undef,
undef,
{
skipAutoCommitWorkflows => 1,
}); });
my $photo; my $photo;
#----------------------------------------------------------------------------
# Cleanup
END {
$gallery->purge;
$album->purge;
if ($photo) {
$photo->purge;
}
$versionTag->rollback;
}
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Tests # Tests
plan tests => 5; plan tests => 5;
@ -61,8 +61,15 @@ use_ok("WebGUI::Asset::File::Image::Photo");
$photo $photo
= $album->addChild({ = $album->addChild({
className => "WebGUI::Asset::File::Image::Photo", className => "WebGUI::Asset::File::Image::Photo",
},
undef,
undef,
{
skipAutoCommitWorkflows => 1,
}); });
$versionTag->commit;
is( is(
blessed $photo, "WebGUI::Asset::File::Image::Photo", blessed $photo, "WebGUI::Asset::File::Image::Photo",
"Photo is a WebGUI::Asset::File::Image::Photo object", "Photo is a WebGUI::Asset::File::Image::Photo object",
@ -72,14 +79,11 @@ isa_ok(
$photo, "WebGUI::Asset::File::Image", $photo, "WebGUI::Asset::File::Image",
); );
TODO: {
local $TODO = 'This test dies, but the subroutine works. Why!?'; is(
ok(0, "Photo->getGallery dies here, but not in WebGUI."); blessed $photo->getGallery, "WebGUI::Asset::Wobject::Gallery",
#is( "Photo->getGallery gets the gallery containing this photo",
# blessed $photo->getGallery, "WebGUI::Asset::Wobject::Gallery", );
# "Photo->getGallery gets the gallery containing this photo",
#);
}
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Test deleting a photo # Test deleting a photo
@ -91,3 +95,10 @@ is(
"Photo no longer able to be instanciated", "Photo no longer able to be instanciated",
); );
#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback;
}

View file

@ -24,15 +24,12 @@ use Test::More;
# Init # Init
my $session = WebGUI::Test->session; my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session); my $node = WebGUI::Asset->getImportNode($session);
my @versionTags = ();
$session->errorHandler->warn('GOOD STUFF HERE');
$session->user({ userId => 3 }); $session->user({ userId => 3 });
my @versionTags = ();
push @versionTags, WebGUI::VersionTag->getWorking($session); push @versionTags, WebGUI::VersionTag->getWorking($session);
$versionTags[-1]->set({name=>"Photo Test, add Gallery, Album and 1 Photo"}); $versionTags[-1]->set({name=>"Photo Test, add Gallery, Album and 1 Photo"});
diag $versionTags[-1]->getId;
my $friend = WebGUI::User->new($session, "new"); my $friend = WebGUI::User->new($session, "new");
WebGUI::Friends->new($session)->add( [ $friend->userId ] ); WebGUI::Friends->new($session)->add( [ $friend->userId ] );
@ -51,8 +48,8 @@ my $album
groupIdEdit => "", groupIdEdit => "",
ownerUserId => $session->user->userId, ownerUserId => $session->user->userId,
}, },
'', undef,
0, undef,
{ {
skipAutoCommitWorkflows => 1, skipAutoCommitWorkflows => 1,
}); });
@ -71,14 +68,12 @@ my $photo
groupIdEdit => "3", groupIdEdit => "3",
ownerUserId => $session->user->userId, ownerUserId => $session->user->userId,
}, },
'', undef,
0, undef,
{ {
skipAutoCommitWorkflows => 1, skipAutoCommitWorkflows => 1,
}); });
diag $photo->get('tagId');
$versionTags[-1]->commit; $versionTags[-1]->commit;
ok( $photo->canView(1), "Visitor can view" ); ok( $photo->canView(1), "Visitor can view" );
@ -101,8 +96,8 @@ $photo
groupIdEdit => "3", groupIdEdit => "3",
ownerUserId => "3", ownerUserId => "3",
}, },
'', undef,
0, undef,
{ {
skipAutoCommitWorkflows => 1, skipAutoCommitWorkflows => 1,
}); });
@ -127,8 +122,8 @@ $photo
groupIdEdit => "", groupIdEdit => "",
ownerUserId => $session->user->userId, ownerUserId => $session->user->userId,
}, },
'', undef,
0, undef,
{ {
skipAutoCommitWorkflows => 1, skipAutoCommitWorkflows => 1,
}); });
@ -153,8 +148,8 @@ $photo
groupIdEdit => "", groupIdEdit => "",
ownerUserId => $session->user->userId, ownerUserId => $session->user->userId,
}, },
'', undef,
0, undef,
{ {
skipAutoCommitWorkflows => 1, skipAutoCommitWorkflows => 1,
}); });