Conflicts: docs/gotcha.txt lib/WebGUI.pm lib/WebGUI/Asset.pm lib/WebGUI/Asset/File/GalleryFile/Photo.pm lib/WebGUI/Asset/Post.pm lib/WebGUI/Asset/Story.pm lib/WebGUI/Asset/Template.pm lib/WebGUI/Asset/Wobject/Calendar.pm lib/WebGUI/Asset/Wobject/GalleryAlbum.pm lib/WebGUI/Asset/Wobject/Navigation.pm lib/WebGUI/AssetLineage.pm lib/WebGUI/AssetTrash.pm lib/WebGUI/Config.pm lib/WebGUI/Form/Template.pm lib/WebGUI/Group.pm lib/WebGUI/Inbox.pm lib/WebGUI/Workflow/Activity/DeleteExpiredSessions.pm lib/WebGUI/Workflow/Activity/TrashExpiredEvents.pm sbin/testEnvironment.pl t/AdSpace.t t/AdSpace/Ad.t t/Asset/Asset.t t/Asset/AssetExportHtml.t t/Asset/AssetLineage.t t/Asset/EMSSubmissionForm.t t/Asset/Event.t t/Asset/File/GalleryFile/Photo/00base.t t/Asset/File/GalleryFile/Photo/comment.t t/Asset/File/GalleryFile/Photo/download.t t/Asset/File/GalleryFile/Photo/edit.t t/Asset/File/GalleryFile/Photo/exif.t t/Asset/File/GalleryFile/Photo/makeResolutions.t t/Asset/File/GalleryFile/Photo/makeShortcut.t t/Asset/File/Image/setfile.t t/Asset/File/setfile.t t/Asset/Post.t t/Asset/Post/Thread/getAdjacentThread.t t/Asset/Sku.t t/Asset/Sku/ProductCollateral.t t/Asset/Story.t t/Asset/Template.t t/Asset/Template/HTMLTemplateExpr.t t/Asset/Wobject/Gallery/00base.t t/Asset/Wobject/GalleryAlbum/00base.t t/Asset/Wobject/GalleryAlbum/ajax.t t/Asset/Wobject/GalleryAlbum/delete.t t/Asset/Wobject/Matrix.t t/Asset/Wobject/StoryArchive.t t/Asset/Wobject/Survey/ExpressionEngine.t t/Asset/Wobject/Survey/Reports.t t/AssetAspect/RssFeed.t t/Auth/mech.t t/Config.t t/Group.t t/Help/isa.t t/International.t t/Mail/Send.t t/Operation/AdSpace.t t/Operation/Auth.t t/Pluggable.t t/Session.t t/Session/DateTime.t t/Session/ErrorHandler.t t/Session/Scratch.t t/Session/Stow.t t/Shop/Cart.t t/Shop/Pay.t t/Shop/PayDriver/ITransact.t t/Shop/PayDriver/PayPalStd.t t/Shop/Ship.t t/Shop/ShipDriver.t t/Shop/TaxDriver/EU.t t/Shop/TaxDriver/Generic.t t/Shop/Transaction.t t/Shop/Vendor.t t/VersionTag.t t/Workflow/Activity/ArchiveOldStories.t t/Workflow/Activity/ExpireIncompleteSurveyResponses.t t/lib/WebGUI/Test.pm
103 lines
3.7 KiB
Perl
103 lines
3.7 KiB
Perl
#-------------------------------------------------------------------
|
|
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
|
#-------------------------------------------------------------------
|
|
# Please read the legal notices (docs/legal.txt) and the license
|
|
# (docs/license.txt) that came with this distribution before using
|
|
# this software.
|
|
#-------------------------------------------------------------------
|
|
# http://www.plainblack.com info@plainblack.com
|
|
#-------------------------------------------------------------------
|
|
|
|
use FindBin;
|
|
use strict;
|
|
use lib "$FindBin::Bin/../../../lib";
|
|
|
|
## The goal of this test is to test the creation and deletion of album assets
|
|
|
|
use WebGUI::Test;
|
|
use WebGUI::Session;
|
|
use Test::More;
|
|
|
|
#----------------------------------------------------------------------------
|
|
# Init
|
|
my $session = WebGUI::Test->session;
|
|
my $node = WebGUI::Asset->getImportNode($session);
|
|
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
|
WebGUI::Test->addToCleanup($versionTag);
|
|
|
|
$versionTag->set({name=>"Album Test"});
|
|
|
|
# Create gallery and a single album
|
|
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,
|
|
});
|
|
|
|
# Create 5 photos inside the gallery
|
|
my @photo;
|
|
|
|
for (my $i = 0; $i < 5; $i++)
|
|
{
|
|
$photo[$i]
|
|
= $album->addChild({
|
|
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
|
},
|
|
undef,
|
|
undef,
|
|
{
|
|
skipAutoCommitWorkflows => 1,
|
|
});
|
|
}
|
|
|
|
# Commit all changes
|
|
$versionTag->commit;
|
|
|
|
#----------------------------------------------------------------------------
|
|
# Tests
|
|
plan tests => 15;
|
|
|
|
#----------------------------------------------------------------------------
|
|
# Test module compiles okay
|
|
use_ok("WebGUI::Asset::Wobject::GalleryAlbum");
|
|
|
|
#----------------------------------------------------------------------------
|
|
# Test getPreviousFileId
|
|
|
|
note 'getPreviousFileId';
|
|
is( $album->getPreviousFileId($photo[2]->getId), $photo[1]->getId, 'Id of photo previous of photo no. 3 equals id of photo no. 2' );
|
|
is( $album->getPreviousFileId($photo[1]->getId), $photo[0]->getId, 'Id of photo previous of photo no. 2 equals id of photo no. 1' );
|
|
is( $album->getPreviousFileId($photo[0]->getId), undef, 'Id of photo previous of photo no. 3 is undef' );
|
|
|
|
is( $album->getPreviousFileId(undef), undef, 'Return undef if undef specified');
|
|
is( $album->getPreviousFileId(''), undef, 'Return undef if empty string specified');
|
|
is( $album->getPreviousFileId('123456'), undef, 'Return undef if non-existing id specified');
|
|
is( $album->getPreviousFileId($album->getId), undef, 'Return undef if non-child id specified');
|
|
|
|
#----------------------------------------------------------------------------
|
|
# Test getNextFileId
|
|
|
|
note 'getNextFileId';
|
|
is( $album->getNextFileId($photo[2]->getId), $photo[3]->getId, 'Id of photo next of photo no. 3 equals id of photo no. 4' );
|
|
is( $album->getNextFileId($photo[3]->getId), $photo[4]->getId, 'Id of photo next of photo no. 4 equals id of photo no. 5' );
|
|
is( $album->getNextFileId($photo[4]->getId), undef, 'Id of photo next of photo no. 5 is undef' );
|
|
|
|
is( $album->getNextFileId(undef), undef, 'Return undef if undef specified');
|
|
is( $album->getNextFileId(''), undef, 'Return undef if empty string specified');
|
|
is( $album->getNextFileId('123456'), undef, 'Return undef if non-existing id specified');
|
|
is( $album->getNextFileId($album->getId), undef, 'Return undef if non-child id specified');
|
|
|
|
#vim:ft=perl
|