Merge branch 'master' into 8-merge
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
This commit is contained in:
commit
babfa74209
238 changed files with 4557 additions and 1287 deletions
|
|
@ -93,3 +93,5 @@ my $properties = $photo->get;
|
|||
$photo->purge;
|
||||
|
||||
dies_ok { WebGUI::Asset->newById($session, $properties->{assetId}) } "Photo no longer able to be instanciated";
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ my $node = WebGUI::Asset->getImportNode($session);
|
|||
|
||||
my @versionTags = ();
|
||||
push @versionTags, WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTags[-1]);
|
||||
$versionTags[-1]->set({name=>"Photo Test, add Gallery, Album and 1 Photo"});
|
||||
WebGUI::Test->addToCleanup($versionTags[-1]);
|
||||
|
||||
|
|
@ -327,3 +328,5 @@ TODO: {
|
|||
# TODO
|
||||
ok( 0, "Visitor has their IP logged in visitorIp field" );
|
||||
}
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
|
|
@ -84,3 +84,4 @@ ok(
|
|||
"getDownloadFileUrl croaks if resolution doesn't exist",
|
||||
);
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
|
|
@ -14,18 +14,29 @@
|
|||
use FindBin;
|
||||
use strict;
|
||||
use lib "$FindBin::Bin/../../../../lib";
|
||||
|
||||
use Test::More;
|
||||
use Test::Deep;
|
||||
|
||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Asset::Wobject::Gallery;
|
||||
use WebGUI::Asset::Wobject::GalleryAlbum;
|
||||
use WebGUI::Asset::File::GalleryFile::Photo;
|
||||
use WebGUI::VersionTag;
|
||||
use WebGUI::Session;
|
||||
|
||||
plan skip_all => 'set WEBGUI_LIVE to enable this test' unless $ENV{WEBGUI_LIVE};
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode( $session );
|
||||
my @versionTags = ( WebGUI::VersionTag->getWorking( $session ) );
|
||||
|
||||
# Create version tag and make sure it gets cleaned up
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
addToCleanup($versionTag);
|
||||
|
||||
# Override some settings to make things easier to test
|
||||
# userFunctionStyleId
|
||||
|
|
@ -34,36 +45,43 @@ $session->setting->set( 'userFunctionStyleId', 'PBtmpl0000000000000132' );
|
|||
$session->setting->set( 'specialState', '' );
|
||||
|
||||
# Create a user for testing purposes
|
||||
my $user = WebGUI::User->new( $session, "new" );
|
||||
my $user = WebGUI::User->new( $session, "new" );
|
||||
WebGUI::Test->addToCleanup($user);
|
||||
$user->username( 'dufresne' . time );
|
||||
my $identifier = 'ritahayworth';
|
||||
my $auth = WebGUI::Operation::Auth::getInstance( $session, $user->authMethod, $user->userId );
|
||||
my $identifier = 'ritahayworth';
|
||||
my $auth = WebGUI::Operation::Auth::getInstance( $session, $user->authMethod, $user->userId );
|
||||
$auth->saveParams( $user->userId, $user->authMethod, {
|
||||
'identifier' => Digest::MD5::md5_base64( $identifier ),
|
||||
});
|
||||
|
||||
my ( $mech );
|
||||
|
||||
# Get the site's base URL
|
||||
my $baseUrl = 'http://' . $session->config->get('sitename')->[0];
|
||||
|
||||
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1 } );
|
||||
|
||||
# Create gallery and a single album
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
title => "gallery",
|
||||
groupIdAddFile => 2, # Registered Users
|
||||
styleTemplateId => "PBtmpl0000000000000132", # Blank Style
|
||||
styleTemplateId => "PBtmpl0000000000000132", # Blank Style
|
||||
});
|
||||
my $album
|
||||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
}, @addArgs );
|
||||
ownerUserId => $user->getId,
|
||||
title => "album",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
$versionTags[-1]->commit;
|
||||
# Commit assets for testing
|
||||
$versionTag->commit;
|
||||
|
||||
my $photo;
|
||||
# Get the site's base URL
|
||||
my $baseUrl = 'http://' . $session->config->get('sitename')->[0];
|
||||
|
||||
# Common variables
|
||||
my ( $mech, $photo );
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -78,18 +96,93 @@ if ( !$mech->success ) {
|
|||
plan skip_all => "Cannot load URL '$baseUrl'. Will not test.";
|
||||
}
|
||||
|
||||
plan tests => 5; # Increment this number for each test you create
|
||||
plan tests => 10; # Increment this number for each test you create
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test permissions for new photos
|
||||
|
||||
$mech = Test::WWW::Mechanize->new;
|
||||
|
||||
# Save a new photo
|
||||
$mech->get( $baseUrl . $album->getUrl("func=add;class=WebGUI::Asset::File::GalleryFile::Photo") );
|
||||
$mech->content_lacks( 'value="editSave"' );
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test editing existing photo
|
||||
|
||||
# Create single photo inside the album
|
||||
$photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
ownerUserId => $user->getId,
|
||||
title => "photo",
|
||||
synopsis => "synopsis",
|
||||
keywords => "keywords",
|
||||
location => "location",
|
||||
friendsOnly => 0,
|
||||
},
|
||||
undef,
|
||||
time() - 5 # Create photo asset in the past to avoid duplicate revision dates
|
||||
);
|
||||
# Attach image file to photo asset
|
||||
$photo->setFile( WebGUI::Test->getTestCollateralPath("rotation_test.png") );
|
||||
|
||||
# New values for photo properties
|
||||
my %properties = (
|
||||
title => 'new photo',
|
||||
synopsis => 'new synopsis',
|
||||
keywords => 'new keywords',
|
||||
location => 'new location',
|
||||
friendsOnly => '1',
|
||||
);
|
||||
|
||||
# Log in
|
||||
$mech = getMechLogin( $baseUrl, $user, $identifier );
|
||||
|
||||
# Request photo edit view
|
||||
$mech->get_ok( $baseUrl . $photo->getUrl('func=edit'), 'Request Photo edit view' );
|
||||
# Try to submit edit form
|
||||
$mech->submit_form_ok({
|
||||
form_name => 'photoEdit',
|
||||
fields => \%properties,
|
||||
},
|
||||
'Submit Photo edit form' );
|
||||
# Re-create instance of Photo asset
|
||||
$photo = WebGUI::Asset->newByDynamicClass($session, $photo->getId);
|
||||
# Check whether properties were changed correctly
|
||||
cmp_deeply($photo->get, superhashof(\%properties), 'All changes applied');
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test redirect to parent's edit view using the "proceed=editParent" parameter
|
||||
|
||||
# Create single photo inside the album
|
||||
$photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
ownerUserId => $user->getId,
|
||||
},
|
||||
undef,
|
||||
time() - 5 # Create photo asset in the past to avoid duplicate revision dates
|
||||
);
|
||||
# Attach image file to photo asset
|
||||
$photo->setFile( WebGUI::Test->getTestCollateralPath("rotation_test.png") );
|
||||
|
||||
|
||||
# Request photo edit view
|
||||
$mech->get_ok( $baseUrl . $photo->getUrl('func=edit;proceed=editParent'), 'Request Photo edit view with "proceed=editParent"' );
|
||||
# Submit changes
|
||||
$mech->submit_form( form_name => 'photoEdit' );
|
||||
# Currently, a redirect using the proceed parameter will not change the URL
|
||||
# nor add the proper "func" argument. We have to look at the page content instead.
|
||||
$mech->content_contains( 'name="galleryAlbumEdit"', "Redirected to parent's edit view" );
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test creating a new Photo
|
||||
|
||||
SKIP: {
|
||||
skip "File control needs to be fixed to be more 508-compliant before this can be used", 4;
|
||||
$mech = getMechLogin( $baseUrl, $user, $identifier );
|
||||
|
|
@ -131,14 +224,6 @@ SKIP: {
|
|||
);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Cleanup
|
||||
END {
|
||||
for my $tag ( @versionTags ) {
|
||||
$tag->rollback;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# getMechLogin( baseUrl, WebGUI::User, "identifier" )
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ use Image::ExifTool qw(:Public);
|
|||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
$versionTag->set({name=>"Photo Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $gallery
|
||||
|
|
@ -80,3 +81,5 @@ is_deeply(
|
|||
[ sort map { $_->{tag} } @{ $var->{exifLoop} } ],
|
||||
"getTemplateVars gets a loop over the tags",
|
||||
);
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ my $node = WebGUI::Asset->getImportNode($session);
|
|||
my @versionTags = ();
|
||||
push @versionTags, WebGUI::VersionTag->getWorking($session);
|
||||
$versionTags[-1]->set({name=>"Photo Test"});
|
||||
WebGUI::Test->addToCleanup($versionTags[-1]);
|
||||
|
||||
my ($gallery, $album, $photo);
|
||||
$gallery
|
||||
|
|
@ -224,3 +225,5 @@ $photo->update({ filename => 'page_title.jpg' });
|
|||
"makeResolutions still makes valid resolutions when invalid resolutions given",
|
||||
);
|
||||
}
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
|
|
@ -132,3 +132,5 @@ cmp_deeply(
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# www_makeShortcut
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ use WebGUI::Asset::File::GalleryFile::Photo;
|
|||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
$versionTag->set({name=>"Photo Test"});
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
|
|
@ -70,10 +71,4 @@ ok(
|
|||
"Generated resolution file exists on the filesystem",
|
||||
);
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Cleanup
|
||||
END {
|
||||
$versionTag->rollback();
|
||||
}
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue