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

View file

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