From 15c3c2e8f6fda478cd4777f90fbf77da5913ae05 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 20 Dec 2007 00:24:38 +0000 Subject: [PATCH] adding version tag commits. all tests pass --- t/Asset/File/Image/Photo/00base.t | 57 +++++++++++++++----------- t/Asset/File/Image/Photo/permissions.t | 27 +++++------- 2 files changed, 45 insertions(+), 39 deletions(-) diff --git a/t/Asset/File/Image/Photo/00base.t b/t/Asset/File/Image/Photo/00base.t index cb732e4e0..ad92facd3 100644 --- a/t/Asset/File/Image/Photo/00base.t +++ b/t/Asset/File/Image/Photo/00base.t @@ -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; +} + + diff --git a/t/Asset/File/Image/Photo/permissions.t b/t/Asset/File/Image/Photo/permissions.t index 3e865b44a..8b08a0a73 100644 --- a/t/Asset/File/Image/Photo/permissions.t +++ b/t/Asset/File/Image/Photo/permissions.t @@ -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, });