almost done fixing addRevision tests
This commit is contained in:
parent
6931fd471e
commit
7c14d1e6c4
122 changed files with 389 additions and 1052 deletions
|
|
@ -273,6 +273,26 @@ sub interceptLogging (&) {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 asset ( props )
|
||||
|
||||
Create a safe asset to use for testing. Add all your assets to this asset and
|
||||
your assets will be automatically cleaned up after the test.
|
||||
|
||||
props is a set of name/value pairs for properties for the new asset. defaults
|
||||
to adding a layout
|
||||
|
||||
=cut
|
||||
|
||||
sub asset {
|
||||
my ( $class, %props ) = @_;
|
||||
$props{className} ||= "WebGUI::Asset::Wobject::Layout";
|
||||
my $asset = WebGUI::Asset->getImportNode( $class->session )->addChild( \%props );
|
||||
addToCleanup( $asset );
|
||||
return $asset;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 config
|
||||
|
||||
Returns the config object from the session.
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ my $session = WebGUI::Test->session;
|
|||
$session->user({userId => 3});
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
my %tag = ( tagId => $versionTag->getId, status => "pending" );
|
||||
$versionTag->set({name=>"Asset Clipboard test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
||||
|
|
@ -35,6 +36,7 @@ my $snippet = $root->addChild({
|
|||
menuTitle => 'snippetMenuTitle',
|
||||
className => 'WebGUI::Asset::Snippet',
|
||||
snippet => 'A snippet of text',
|
||||
%tag,
|
||||
}, undef, time()-3);
|
||||
|
||||
my $snippetAssetId = $snippet->getId;
|
||||
|
|
@ -45,24 +47,28 @@ my $topFolder = $root->addChild({
|
|||
menuTitle => 'topFolderMenuTitle',
|
||||
groupIdEdit => 3,
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
%tag,
|
||||
});
|
||||
my $folder1a = $topFolder->addChild({
|
||||
url => 'folder_1a',
|
||||
title => 'folder1a',
|
||||
groupIdEdit => 3,
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
%tag,
|
||||
});
|
||||
my $folder1b = $topFolder->addChild({
|
||||
url => 'folder_1b',
|
||||
title => 'folder1b',
|
||||
groupIdEdit => 3,
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
%tag,
|
||||
});
|
||||
my $folder1a2 = $folder1a->addChild({
|
||||
url => 'folder_1a2',
|
||||
title => 'folder1a2',
|
||||
groupIdEdit => 3,
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
%tag,
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -82,9 +88,7 @@ is($snippet->getId, $snippetAssetId, 'original snippet has cor
|
|||
is($snippet->getParent->getId, $root->getId, 'original snippet is a child of root');
|
||||
is($duplicatedSnippet->getParent->getId, $root->getId, 'duplicated snippet is also a child of root');
|
||||
|
||||
my $newVersionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$newVersionTag->commit;
|
||||
WebGUI::Test->addToCleanup($newVersionTag);
|
||||
addToCleanup( $duplicatedSnippet );
|
||||
|
||||
####################################################
|
||||
#
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ my $session = WebGUI::Test->session;
|
|||
$session->user({userId => 3});
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
my %tag = ( tagId => $versionTag->getId, status => "pending" );
|
||||
$versionTag->set({name=>"Asset Package test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
||||
|
|
@ -41,6 +42,7 @@ my $folder = $root->addChild({
|
|||
menuTitle => 'folderMenuTitle',
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
isPackage => 1,
|
||||
%tag,
|
||||
});
|
||||
|
||||
my $snippet = $folder->addChild({
|
||||
|
|
@ -49,6 +51,7 @@ my $snippet = $folder->addChild({
|
|||
menuTitle => 'snippetMenuTitle',
|
||||
className => 'WebGUI::Asset::Snippet',
|
||||
snippet => 'A snippet of text',
|
||||
%tag,
|
||||
});
|
||||
|
||||
$versionTag->commit;
|
||||
|
|
|
|||
|
|
@ -21,18 +21,21 @@ plan tests => 26;
|
|||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $propertyHash = {
|
||||
my %propertyHash = (
|
||||
template => "Hi, I'm a snippet",
|
||||
url => '/template/versionTest',
|
||||
title => 'Version Test Snippet',
|
||||
menuTitle => 'Version Test Snippet',
|
||||
namespace => 'Snippet',
|
||||
className => 'WebGUI::Asset::Snippet',
|
||||
};
|
||||
);
|
||||
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
|
||||
my $originalVersionTags = $session->db->quickScalar(q{select count(*) from assetVersionTag});
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
WebGUI::Test->addToCleanup($tag);
|
||||
my %tag = ( tagId => $tag->getId, status => "pending" );
|
||||
|
||||
################################################################
|
||||
#
|
||||
|
|
@ -41,15 +44,13 @@ my $originalVersionTags = $session->db->quickScalar(q{select count(*) from asset
|
|||
################################################################
|
||||
|
||||
note "purgeRevision tests";
|
||||
my $snippet = $root->addChild($propertyHash);
|
||||
my $snippet = $root->addChild({%propertyHash,%tag});
|
||||
$snippet->commit;
|
||||
|
||||
isa_ok $snippet, "WebGUI::Asset::Snippet";
|
||||
checkTableEntries($snippet->getId, 1,1,1,1);
|
||||
|
||||
sleep 1;
|
||||
|
||||
my $snippetv2 = $snippet->addRevision({snippet => 'Hello, I am a snippet with formal grammar'});
|
||||
my $snippetv2 = $snippet->addRevision({snippet => 'Hello, I am a snippet with formal grammar',%tag},time+1);
|
||||
$snippetv2->commit;
|
||||
|
||||
is ($snippetv2->getId, $snippet->getId, 'Both versions of the asset have the same assetId');
|
||||
|
|
@ -61,7 +62,7 @@ checkTableEntries($snippetv2->getId, 1,1,1,1);
|
|||
|
||||
undef $snippetv2;
|
||||
|
||||
my $snippetv2a = $snippet->addRevision({snippet => 'Hey, yall! Ima snippet.'});
|
||||
my $snippetv2a = $snippet->addRevision({snippet => 'Hey, yall! Ima snippet.',%tag},time+2);
|
||||
$snippetv2a->commit;
|
||||
|
||||
$snippet->purgeRevision;
|
||||
|
|
@ -81,15 +82,13 @@ is($versionTagCheck, $originalVersionTags, 'version tag cleaned up by deleting l
|
|||
#
|
||||
################################################################
|
||||
|
||||
$snippet = $root->addChild($propertyHash);
|
||||
my $tag1 = WebGUI::VersionTag->getWorking($session);
|
||||
$tag1->commit;
|
||||
WebGUI::Test->addToCleanup($tag1);
|
||||
sleep 1;
|
||||
$snippetv2 = $snippet->addRevision({snippet => 'Vie gates. Ich bin ein snippetr.'});
|
||||
$snippet = $root->addChild({%propertyHash,%tag});
|
||||
$tag->commit;
|
||||
my $tag2 = WebGUI::VersionTag->getWorking($session);
|
||||
$tag2->commit;
|
||||
$tag{tagId} = $tag2->getId;
|
||||
WebGUI::Test->addToCleanup($tag2);
|
||||
$snippetv2 = $snippet->addRevision({snippet => 'Vie gates. Ich bin ein snippetr.',%tag}, time+3);
|
||||
$tag2->commit;
|
||||
note "purge";
|
||||
checkTableEntries($snippetv2->getId, 1,2,2);
|
||||
$versionTagCheck = $session->db->quickScalar(q{select count(*) from assetVersionTag});
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ my $calendar = $node->addChild({
|
|||
groupIdView => '7', # Everyone
|
||||
groupIdEdit => '3', # Admins
|
||||
groupIdEventEdit => '2', # Registered Users
|
||||
tagId => $versionTags[-1]->getId,
|
||||
status => "pending",
|
||||
});
|
||||
|
||||
$versionTags[-1]->commit;
|
||||
|
|
@ -62,6 +64,8 @@ WebGUI::Test->addToCleanup($versionTags[-1]);
|
|||
$event = $calendar->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
ownerUserId => 3,
|
||||
tagId => $versionTags[-1]->getId,
|
||||
status => "pending",
|
||||
}, @addArgs);
|
||||
|
||||
$maker->prepare( {
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ my $properties = {
|
|||
title => 'File Asset Test',
|
||||
className => 'WebGUI::Asset::File',
|
||||
url => 'file-asset-test',
|
||||
tagId => $versionTag->getId,
|
||||
status => "pending",
|
||||
};
|
||||
my $defaultAsset = WebGUI::Asset->getDefault($session);
|
||||
my $asset = $defaultAsset->addChild($properties, $properties->{id});
|
||||
|
|
@ -107,7 +109,7 @@ cmp_deeply(
|
|||
#----------------------------------------------------------------------------
|
||||
# Add another new revision, changing the privs
|
||||
my $newRev = $asset->addRevision( { ownerUserId => '3', groupIdView => '3' }, time + 5 );
|
||||
WebGUI::Test::addToCleanup( WebGUI::VersionTag->getWorking( $session ) );
|
||||
addToCleanup( $newRev );
|
||||
$privs = JSON->new->decode( $newRev->getStorageLocation->getFileContentsAsScalar('.wgaccess') );
|
||||
cmp_deeply(
|
||||
$privs,
|
||||
|
|
@ -121,7 +123,7 @@ cmp_deeply(
|
|||
|
||||
# Add a new revision, changing the privs
|
||||
my $newRev = $asset->addRevision( { groupIdView => '7' }, time + 8 );
|
||||
WebGUI::Test::addToCleanup( WebGUI::VersionTag->getWorking( $session ) );
|
||||
addToCleanup( $newRev );
|
||||
is( $newRev->getStorageLocation->getFileContentsAsScalar('.wgaccess'), undef, "wgaccess doesn't exist" );
|
||||
|
||||
############################################
|
||||
|
|
|
|||
|
|
@ -26,10 +26,12 @@ my $versionTag = WebGUI::VersionTag->getWorking($session);
|
|||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
||||
$versionTag->set({name=>"Photo Test"});
|
||||
my %tag = ( tagId => $versionTag->getId, status => "pending" );
|
||||
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
%tag,
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
@ -39,6 +41,7 @@ my $gallery
|
|||
my $album
|
||||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
%tag,
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
@ -61,6 +64,7 @@ use_ok("WebGUI::Asset::File::GalleryFile::Photo");
|
|||
$photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
%tag,
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ my $versionTag = WebGUI::VersionTag->getWorking($session);
|
|||
|
||||
# Name version tag and make sure it gets cleaned up
|
||||
$versionTag->set({name=>"Orientation adjustment test"});
|
||||
my %tag = ( tagId => $versionTag->getId, status => "pending" );
|
||||
addToCleanup($versionTag);
|
||||
|
||||
# Create gallery and a single album
|
||||
|
|
@ -38,6 +39,7 @@ my $gallery
|
|||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
imageResolutions => "1024",
|
||||
%tag,
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
@ -47,6 +49,7 @@ my $gallery
|
|||
my $album
|
||||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
%tag,
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
@ -58,6 +61,7 @@ my $album
|
|||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
%tag,
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
|
|||
|
|
@ -24,30 +24,20 @@ use WebGUI::International;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
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]);
|
||||
|
||||
my @addArguments = ( undef, undef, { skipAutoCommitWorkflows => 1 } );
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
groupIdAddComment => "2", # "Registered Users"
|
||||
});
|
||||
);
|
||||
my $album
|
||||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
}, @addArguments );
|
||||
});
|
||||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
}, @addArguments );
|
||||
|
||||
$versionTags[-1]->commit;
|
||||
});
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
|
@ -256,7 +246,7 @@ my $html;
|
|||
$photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
}, @addArguments );
|
||||
});
|
||||
|
||||
# Permissions
|
||||
$html = WebGUI::Test->getPage($photo, "www_editCommentSave", {
|
||||
|
|
|
|||
|
|
@ -22,40 +22,22 @@ use WebGUI::Asset::File::GalleryFile::Photo;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
|
||||
my @versionTags = ();
|
||||
push @versionTags, WebGUI::VersionTag->getWorking($session);
|
||||
$versionTags[-1]->set({name=>"Photo Test, add Gallery, Album and 1 Photo"});
|
||||
WebGUI::Test->addToCleanup($versionTags[-1]);
|
||||
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
imageResolutions => "100\n200\n300",
|
||||
groupIdView => 7,
|
||||
});
|
||||
);
|
||||
my $album
|
||||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
$versionTags[-1]->commit;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
plan tests => 3;
|
||||
|
|
|
|||
|
|
@ -26,14 +26,16 @@ 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 %tag = ( tagId => $versionTag->getId, status => "pending" );
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
%tag,
|
||||
});
|
||||
my $album
|
||||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
%tag,
|
||||
},
|
||||
undef, undef,
|
||||
{ skipAutoCommitWorkflows => 1 },
|
||||
|
|
@ -41,6 +43,7 @@ my $album
|
|||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
%tag,
|
||||
},
|
||||
undef, undef,
|
||||
{ skipAutoCommitWorkflows => 1 },
|
||||
|
|
|
|||
|
|
@ -24,25 +24,16 @@ use WebGUI::Asset::File::GalleryFile::Photo;
|
|||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
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
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
imageResolutions => "1600\n1024\n800\n640",
|
||||
});
|
||||
);
|
||||
$album
|
||||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -54,14 +45,7 @@ plan tests => 14;
|
|||
$photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
$versionTags[-1]->commit;
|
||||
WebGUI::Test->addToCleanup($versionTags[-1]);
|
||||
$photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollateralPath('page_title.jpg') );
|
||||
$photo->update({ filename => 'page_title.jpg' });
|
||||
|
||||
|
|
@ -91,32 +75,19 @@ TODO: {
|
|||
#----------------------------------------------------------------------------
|
||||
# Array of resolutions passed to makeResolutions overrides defaults from
|
||||
# parent asset
|
||||
push @versionTags, WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTags[-1]);
|
||||
$gallery
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
imageResolutions => "1600\n1024\n800\n640",
|
||||
});
|
||||
);
|
||||
$album
|
||||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
$photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
$versionTags[-1]->commit;
|
||||
$photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollateralPath('page_title.jpg') );
|
||||
$photo->update({ filename => 'page_title.jpg' });
|
||||
|
||||
|
|
@ -145,18 +116,10 @@ TODO: {
|
|||
#----------------------------------------------------------------------------
|
||||
# makeResolutions allows API to specify resolutions to make as array reference
|
||||
# argument
|
||||
push @versionTags, WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTags[-1]);
|
||||
$photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
$versionTags[-1]->commit;
|
||||
|
||||
$photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollateralPath('page_title.jpg') );
|
||||
$photo->update({ filename => 'page_title.jpg' });
|
||||
|
|
@ -183,18 +146,10 @@ TODO: {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# makeResolutions throws a warning on an invalid resolution but keeps going
|
||||
push @versionTags, WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTags[-1]);
|
||||
$photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
$versionTags[-1]->commit;
|
||||
$photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollateralPath('page_title.jpg') );
|
||||
$photo->update({ filename => 'page_title.jpg' });
|
||||
{ # localize our signal handler
|
||||
|
|
|
|||
|
|
@ -24,41 +24,26 @@ use WebGUI::Asset::File::GalleryFile::Photo;
|
|||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Photo Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $otherParent
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Wobject::Layout",
|
||||
});
|
||||
);
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
imageResolutions => "1600x1200\n1024x768\n800x600\n640x480",
|
||||
});
|
||||
);
|
||||
my $album
|
||||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
userDefined1 => "ORIGINAL",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
$versionTag->commit;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
plan tests => 10;
|
||||
|
|
|
|||
|
|
@ -20,30 +20,15 @@ use Test::More;
|
|||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
|
||||
$versionTag->set({name=>"Photo Test"});
|
||||
|
||||
addToCleanup($versionTag);
|
||||
|
||||
# Create gallery and a single album
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
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
|
||||
|
|
@ -54,17 +39,9 @@ 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 => 11;
|
||||
|
|
|
|||
|
|
@ -25,9 +25,6 @@ my $node = WebGUI::Asset->getImportNode($session);
|
|||
my $maker = WebGUI::Test::Maker::Permission->new;
|
||||
|
||||
$session->user({ userId => 3 });
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Photo Test, add Gallery, Album and 1 Photo"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
||||
# Add a new user to the test user's friends list
|
||||
my $friend = WebGUI::User->new($session, "new");
|
||||
|
|
@ -39,13 +36,13 @@ my $notFriend = WebGUI::User->new( $session, "new" );
|
|||
WebGUI::Test->addToCleanup($notFriend);
|
||||
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
groupIdView => "2", # Registered Users
|
||||
groupIdEdit => "3", # Admins
|
||||
groupIdComment => "2", # Registered Users
|
||||
ownerUserId => $session->user->userId,
|
||||
});
|
||||
);
|
||||
|
||||
my $album
|
||||
= $gallery->addChild({
|
||||
|
|
@ -53,38 +50,24 @@ my $album
|
|||
groupIdView => "2", # Registered Users
|
||||
groupIdEdit => "3", # Admins
|
||||
ownerUserId => $session->user->userId,
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
friendsOnly => 0,
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
$versionTag->commit;
|
||||
|
||||
my $photo2 = $photo->cloneFromDb;
|
||||
my $album2 = $album->cloneFromDb;
|
||||
|
||||
$session->stow->delete('assetRevision');
|
||||
$versionTag->leaveTag;
|
||||
|
||||
$session->user({userId => $notFriend->userId});
|
||||
note "If you get stuck here, then there is an infinite loop in getParent/getGallery";
|
||||
my $album2a = WebGUI::Asset->new($session, $photo2->getId);
|
||||
$session->user({userId => 1});
|
||||
|
||||
$versionTag->commit;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
plan tests => 40;
|
||||
|
|
|
|||
|
|
@ -25,51 +25,28 @@ use Test::Deep;
|
|||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
|
||||
# Name version tag and make sure it gets cleaned up
|
||||
$versionTag->set({name=>"Photo rotation test"});
|
||||
addToCleanup($versionTag);
|
||||
|
||||
# Create gallery and a single album
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
imageResolutions => "1024",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
);
|
||||
my $album
|
||||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
# Create single photo inside the album
|
||||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
# Attach image file to photo asset (setFile also makes download versions)
|
||||
$photo->setFile( WebGUI::Test->getTestCollateralPath("rotation_test.png") );
|
||||
my $storage = $photo->getStorageLocation;
|
||||
|
||||
# Commit all changes
|
||||
$versionTag->commit;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
plan tests => 2;
|
||||
|
|
|
|||
|
|
@ -21,34 +21,19 @@ use WebGUI::Asset::File::GalleryFile::Photo;
|
|||
#----------------------------------------------------------------------------
|
||||
# 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=>"Photo Test"});
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
imageResolutions => "1024",
|
||||
});
|
||||
);
|
||||
my $album
|
||||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
$versionTag->commit;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
|
|
|||
|
|
@ -23,67 +23,37 @@ use WebGUI::Asset::File::GalleryFile::Photo;
|
|||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $user = WebGUI::User->new( $session, 3 );
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
|
||||
$versionTag->set({name=>"Photo Test"});
|
||||
addToCleanup($versionTag);
|
||||
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
groupIdAddComment => 7, # Everyone
|
||||
groupIdAddFile => 2, # Registered Users
|
||||
});
|
||||
);
|
||||
|
||||
my $album
|
||||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
my $previousPhoto
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
ownerUserId => $user->getId,
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
ownerUserId => $user->getId,
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
my $nextPhoto
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
ownerUserId => $user->getId,
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
$versionTag->commit;
|
||||
foreach my $asset ($gallery, $album, $photo) {
|
||||
$asset = $asset->cloneFromDb;
|
||||
}
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
$photo->setFile( WebGUI::Test->getTestCollateralPath('page_title.jpg') );
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -51,9 +51,6 @@ cmp_bag($storage->getFiles, ['blue.png'], 'Only 1 file in storage with correct n
|
|||
##Initialize an Image Asset with that filename and storage location
|
||||
|
||||
$session->user({userId=>3});
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
$versionTag->set({name=>"Image Asset test"});
|
||||
my $properties = {
|
||||
# '1234567890123456789012'
|
||||
id => 'ImageAssetTest00000001',
|
||||
|
|
@ -61,7 +58,7 @@ my $properties = {
|
|||
className => 'WebGUI::Asset::File::Image',
|
||||
url => 'image-asset-test',
|
||||
};
|
||||
my $defaultAsset = WebGUI::Asset->getDefault($session);
|
||||
my $defaultAsset = WebGUI::Test->asset();
|
||||
my $asset = $defaultAsset->addChild($properties, $properties->{id});
|
||||
|
||||
ok($asset->getStorageLocation, 'Image Asset getStorageLocation initialized');
|
||||
|
|
@ -119,8 +116,6 @@ $asset->update({
|
|||
like($templateVars->{parameters}, qr{alt="alternate"}, 'original parameters included');
|
||||
}
|
||||
|
||||
$versionTag->commit;
|
||||
|
||||
done_testing();
|
||||
|
||||
sub isnt_array {
|
||||
|
|
|
|||
|
|
@ -21,16 +21,10 @@ use WebGUI::Asset::File::Image;
|
|||
#----------------------------------------------------------------------------
|
||||
# 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=>"Image Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $image
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::File::Image",
|
||||
});
|
||||
$versionTag->commit;
|
||||
);
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
|
|
|||
|
|
@ -20,16 +20,10 @@ use WebGUI::Asset::File;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"File Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $file
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::File",
|
||||
});
|
||||
$versionTag->commit;
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
);
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
|
|
|||
|
|
@ -48,15 +48,11 @@ WebGUI::Test->addToCleanup(SQL => 'drop table jsonCollateralDummy');
|
|||
|
||||
plan tests => 40;
|
||||
|
||||
my $asset = WebGUI::Asset->getDefault($session)->addChild({
|
||||
my $asset = WebGUI::Test->asset->addChild({
|
||||
className => 'WebGUI::Asset::JSONCollateralDummy',
|
||||
title => 'JSON Collateral Test Asset',
|
||||
});
|
||||
|
||||
my $tag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($tag);
|
||||
$tag->commit;
|
||||
|
||||
################################################################
|
||||
#
|
||||
# Checking Asset serialization
|
||||
|
|
|
|||
|
|
@ -20,21 +20,10 @@ use WebGUI::Asset::MatrixListing;
|
|||
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my ($matrix, $matrixListing);
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
$versionTag->set({name=>"Matrix Listing Test"});
|
||||
|
||||
$matrix = $node->addChild({className=>'WebGUI::Asset::Wobject::Matrix'});
|
||||
$versionTag->commit;
|
||||
$matrix = WebGUI::Test->asset(className=>'WebGUI::Asset::Wobject::Matrix');
|
||||
$matrixListing = $matrix->addChild({className=>'WebGUI::Asset::MatrixListing'});
|
||||
|
||||
# Wikis create and autocommit a version tag when a child is added. Lets get the name so we can roll it back.
|
||||
my $secondVersionTag = WebGUI::VersionTag->new($session,$matrixListing->get("tagId"));
|
||||
WebGUI::Test->addToCleanup($secondVersionTag);
|
||||
|
||||
# Test for sane object types
|
||||
isa_ok($matrix, 'WebGUI::Asset::Wobject::Matrix');
|
||||
isa_ok($matrixListing, 'WebGUI::Asset::MatrixListing');
|
||||
|
|
|
|||
|
|
@ -31,15 +31,11 @@ my $session = WebGUI::Test->session;
|
|||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
|
||||
# Grab a named version tag
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Collab setup"});
|
||||
|
||||
# Need to create a Collaboration system in which the post lives.
|
||||
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1 } );
|
||||
|
||||
my $collab = $node->addChild({className => 'WebGUI::Asset::Wobject::Collaboration', editTimeout => '1'}, @addArgs);
|
||||
|
||||
# The Collaboration system must be committed before a post can be made.
|
||||
my $collab = WebGUI::Test->asset->addChild({className => 'WebGUI::Asset::Wobject::Collaboration', editTimeout => '1'}, @addArgs);
|
||||
|
||||
# Need to do $post->canEdit tests, which test group membership. Therefore,
|
||||
# create three users and a group for the process. One user will be doing the
|
||||
|
|
@ -81,10 +77,6 @@ my $props = {
|
|||
|
||||
my $post = $collab->addChild($props, @addArgs);
|
||||
|
||||
$versionTag->commit();
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
$post = $post->cloneFromDb;
|
||||
|
||||
# Test for a sane object type
|
||||
isa_ok($post, 'WebGUI::Asset::Post::Thread');
|
||||
|
||||
|
|
@ -97,7 +89,6 @@ isa_ok($post, 'WebGUI::Asset::Post::Thread');
|
|||
# so for the test that's supposed to pass (for $otherUser, who's in
|
||||
# $groupToEditPost), we need to change the session user a second time. The same
|
||||
# applies for $groupIdEditUser, for a total of three user changes.
|
||||
sleep 1;
|
||||
|
||||
ok(!$post->canEdit(), "Posting user can't edit after editTime has passed");
|
||||
|
||||
|
|
@ -136,7 +127,6 @@ is($synopsis, q|less than < greater than >|, '... HTML entities decoded by HTML:
|
|||
#
|
||||
######################################################################
|
||||
|
||||
my $versionTag2 = WebGUI::VersionTag->getWorking($session);
|
||||
my $post1 = $collab->addChild({
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
content => 'hello, world!',
|
||||
|
|
@ -147,8 +137,6 @@ my $post2 = $collab->addChild({
|
|||
content => 'hello, world!',
|
||||
ownerUserId => 1,
|
||||
}, @addArgs);
|
||||
$versionTag2->commit();
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $variables;
|
||||
$session->user({userId => 1});
|
||||
$variables = $post1->getTemplateVars();
|
||||
|
|
|
|||
|
|
@ -28,11 +28,13 @@ $versionTag->set({name=>"Collab setup"});
|
|||
addToCleanup($versionTag);
|
||||
|
||||
# Need to create a Collaboration system in which the post lives.
|
||||
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1 } );
|
||||
my @addArgs = ( undef, undef, { skipNotification => 1 } );
|
||||
my $collab = $node->addChild({
|
||||
className => 'WebGUI::Asset::Wobject::Collaboration',
|
||||
editTimeout => '1',
|
||||
threadsPerPage => 3,
|
||||
status => "pending",
|
||||
tagId => $versionTag->getId,
|
||||
},
|
||||
@addArgs);
|
||||
|
||||
|
|
@ -47,12 +49,14 @@ my $props = {
|
|||
};
|
||||
|
||||
my $thread = $collab->addChild($props, @addArgs);
|
||||
$thread->setSkipNotification;
|
||||
|
||||
$versionTag->commit();
|
||||
$collab = $collab->cloneFromDb;
|
||||
$thread = $thread->cloneFromDb;
|
||||
|
||||
my $uncommittedThread = $collab->addChild($props, @addArgs);
|
||||
$uncommittedThread->setSkipNotification;
|
||||
|
||||
# Test for a sane object type
|
||||
isa_ok($thread, 'WebGUI::Asset::Post::Thread');
|
||||
|
|
@ -74,10 +78,12 @@ note 'getCSLinkUrl';
|
|||
my @newThreads;
|
||||
my $threadCount = 15;
|
||||
my $versionTag2 = WebGUI::VersionTag->getWorking($session);
|
||||
addToCleanup( $versionTag2 );
|
||||
$props->{tagId} = $versionTag2->getId;
|
||||
while ($threadCount--) {
|
||||
push @newThreads, $collab->addChild($props, @addArgs);
|
||||
}
|
||||
$_->setSkipNotification for @newThreads;
|
||||
$versionTag2->commit;
|
||||
|
||||
my $csUrl = $collab->get('url');
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ my $session = WebGUI::Test->session;
|
|||
|
||||
my @versionTags = ( WebGUI::VersionTag->getWorking( $session ) );
|
||||
my @addChildArgs = ( {skipAutoCommitWorkflows=>1} );
|
||||
my $collab = WebGUI::Asset->getImportNode( $session )->addChild({
|
||||
my $collab = WebGUI::Test->asset(
|
||||
className => 'WebGUI::Asset::Wobject::Collaboration',
|
||||
threadsPerPage => 20,
|
||||
});
|
||||
);
|
||||
|
||||
my @threads = (
|
||||
$collab->addChild( {
|
||||
|
|
@ -58,11 +58,6 @@ my @threads = (
|
|||
);
|
||||
|
||||
$_->setSkipNotification for @threads;
|
||||
$versionTags[-1]->commit;
|
||||
WebGUI::Test->addToCleanup($versionTags[-1]);
|
||||
foreach my $asset(@threads, $collab) {
|
||||
$asset = $asset->cloneFromDb;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
|
@ -141,6 +136,8 @@ push @threads, $collab->addChild( {
|
|||
title => "Abababa",
|
||||
isSticky => 0,
|
||||
threadRating => 1_000_000,
|
||||
tagId => $versionTags[-1]->getId,
|
||||
status => "pending",
|
||||
}, undef, 6, @addChildArgs
|
||||
);
|
||||
$sort = sub { $b->get('revisionDate') <=> $a->get('revisionDate') };
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ my $collab
|
|||
canStartThreadGroupId => 3, # Admin
|
||||
allowReplies => 1,
|
||||
editTimeout => 60 * 60 * 24, # 24 hours
|
||||
tagId => $versionTag->getId,
|
||||
status => "pending",
|
||||
}, @addArgs );
|
||||
|
||||
my $thread
|
||||
|
|
@ -55,7 +57,10 @@ my $thread
|
|||
className => 'WebGUI::Asset::Post::Thread',
|
||||
ownerUserId => $user{"2"}->userId,
|
||||
groupIdView => 7,
|
||||
tagId => $versionTag->getId,
|
||||
status => "pending",
|
||||
}, @addArgs );
|
||||
$thread->setSkipNotification;
|
||||
|
||||
$versionTag->commit( { timeout => 1_000_000 } );
|
||||
|
||||
|
|
|
|||
|
|
@ -40,30 +40,30 @@ my $first_thread = $collab->addChild(
|
|||
{ className => 'WebGUI::Asset::Post::Thread', %tag },
|
||||
undef,
|
||||
WebGUI::Test->webguiBirthday,
|
||||
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
|
||||
);
|
||||
$first_thread->setSkipNotification;
|
||||
|
||||
my $second_thread = $collab->addChild(
|
||||
{ className => 'WebGUI::Asset::Post::Thread', %tag },
|
||||
undef,
|
||||
WebGUI::Test->webguiBirthday,
|
||||
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
|
||||
);
|
||||
$second_thread->setSkipNotification;
|
||||
|
||||
##Thread 1, Post 1 => t1p1
|
||||
my $t1p1 = $first_thread->addChild(
|
||||
{ className => 'WebGUI::Asset::Post', %tag },
|
||||
undef,
|
||||
WebGUI::Test->webguiBirthday,
|
||||
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
|
||||
);
|
||||
$t1p1->setSkipNotification;
|
||||
|
||||
my $t1p2 = $first_thread->addChild(
|
||||
{ className => 'WebGUI::Asset::Post', %tag },
|
||||
undef,
|
||||
WebGUI::Test->webguiBirthday + 1,
|
||||
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
|
||||
);
|
||||
$t1p2->setSkipNotification;
|
||||
|
||||
my $past = time()-15;
|
||||
|
||||
|
|
@ -71,15 +71,13 @@ my $t2p1 = $second_thread->addChild(
|
|||
{ className => 'WebGUI::Asset::Post', %tag },
|
||||
undef,
|
||||
$past,
|
||||
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
|
||||
);
|
||||
$t2p1->setSkipNotification;
|
||||
|
||||
my $t2p2 = $second_thread->addChild(
|
||||
{ className => 'WebGUI::Asset::Post', %tag },
|
||||
undef,
|
||||
undef,
|
||||
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
|
||||
);
|
||||
$t2p2->setSkipNotification;
|
||||
|
||||
$versionTag->commit();
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
|
|
|||
|
|
@ -26,16 +26,14 @@ my $node = WebGUI::Asset->getImportNode($session);
|
|||
# Grab a named version tag
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Collab setup"});
|
||||
|
||||
# Need to create a Collaboration system in which the post lives.
|
||||
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1 } );
|
||||
my %tag = ( tagId => $versionTag->getId, status => "pending" );
|
||||
|
||||
my $collab = $node->addChild(
|
||||
{
|
||||
className => 'WebGUI::Asset::Wobject::Collaboration',
|
||||
title => 'Test Collaboration',
|
||||
%tag,
|
||||
},
|
||||
@addArgs
|
||||
);
|
||||
|
||||
# finally, add posts and threads to the collaboration system
|
||||
|
|
@ -44,18 +42,20 @@ my $first_thread = $collab->addChild(
|
|||
{
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
title => 'Test Thread',
|
||||
%tag,
|
||||
},
|
||||
@addArgs
|
||||
);
|
||||
$first_thread->setSkipNotification;
|
||||
|
||||
##Thread 1, Post 1 => t1p1
|
||||
my $t1p1 = $first_thread->addChild(
|
||||
{
|
||||
className => 'WebGUI::Asset::Post',
|
||||
title => 'Test Post',
|
||||
%tag,
|
||||
},
|
||||
@addArgs
|
||||
);
|
||||
$t1p1->setSkipNotification;
|
||||
|
||||
$versionTag->commit();
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
|
|
|||
|
|
@ -24,29 +24,31 @@ use Encode;
|
|||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
# Do our work in the import node
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
|
||||
# Grab a named version tag
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Collab setup"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my %tag = ( tagId => $versionTag->getId, status => "pending" );
|
||||
|
||||
# Need to create a Collaboration system in which the post lives.
|
||||
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1 } );
|
||||
|
||||
my $notification_template = $node->addChild({
|
||||
my $notification_template = WebGUI::Test->asset(
|
||||
className => 'WebGUI::Asset::Template',
|
||||
template => "<body>!!!url:<tmpl_var url>!!!content:<tmpl_var content>!!!</body>",
|
||||
}, @addArgs);
|
||||
%tag,
|
||||
);
|
||||
|
||||
my $collab = $node->addChild({
|
||||
my $collab = WebGUI::Test->asset(
|
||||
className => 'WebGUI::Asset::Wobject::Collaboration',
|
||||
notificationTemplateId => $notification_template->getId,
|
||||
}, @addArgs);
|
||||
%tag,
|
||||
);
|
||||
|
||||
# finally, add posts and threads to the collaboration system
|
||||
|
||||
my $first_thread = $collab->addChild( { className => 'WebGUI::Asset::Post::Thread', }, @addArgs);
|
||||
my $first_thread = $collab->addChild( { className => 'WebGUI::Asset::Post::Thread', %tag },);
|
||||
$first_thread->setSkipNotification;
|
||||
|
||||
##Thread 1, Post 1 => t1p1
|
||||
my $title = "H\x{00E4}ufige Fragen";
|
||||
|
|
@ -59,13 +61,12 @@ my $t1p1 = $first_thread->addChild(
|
|||
title => $title,
|
||||
url => lc $title,
|
||||
content => $content,
|
||||
%tag,
|
||||
},
|
||||
@addArgs
|
||||
);
|
||||
$t1p1->setSkipNotification;
|
||||
|
||||
$versionTag->commit();
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
||||
is $t1p1->get('title'), "H\x{00E4}ufige Fragen", "utf8 in title set correctly";
|
||||
is $t1p1->get('url'), "h\x{00E4}ufige-fragen", "... in url";
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ $user{"2"}->addToGroups( ['2'] ); # Registered user
|
|||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking( $session );
|
||||
$versionTag->set( { name => "Collaboration Test" } );
|
||||
my %tag = ( tagId => $versionTag->getId, status => "pending" );
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
||||
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1 } );
|
||||
|
|
@ -48,19 +49,24 @@ my $collab
|
|||
canStartThreadGroupId => 3, # Admin
|
||||
allowReplies => 1,
|
||||
editTimeout => 60 * 60 * 24, # 24 hours
|
||||
%tag,
|
||||
}, @addArgs );
|
||||
|
||||
my $thread
|
||||
= $collab->addChild({
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
ownerUserId => $user{"2"}->userId,
|
||||
%tag,
|
||||
}, @addArgs );
|
||||
$thread->setSkipNotification;
|
||||
|
||||
my $post
|
||||
= $thread->addChild({
|
||||
className => 'WebGUI::Asset::Post',
|
||||
ownerUserId => $user{"2"}->userId,
|
||||
%tag,
|
||||
}, @addArgs );
|
||||
$post->setSkipNotification;
|
||||
|
||||
$versionTag->commit( { timeout => 1_000_000 } );
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ my %tag = ( tagId => $versionTag->getId, status => "pending" );
|
|||
# Need to create a Collaboration system in which the post lives.
|
||||
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1 } );
|
||||
|
||||
my $collab = $node->addChild({className => 'WebGUI::Asset::Wobject::Collaboration', %tag }, @addArgs);
|
||||
my $collab = $node->addChild({className => 'WebGUI::Asset::Wobject::Collaboration', %tag }, );
|
||||
|
||||
# finally, add posts and threads to the collaboration system
|
||||
|
||||
|
|
@ -40,14 +40,12 @@ my $first_thread = $collab->addChild(
|
|||
{ className => 'WebGUI::Asset::Post::Thread', %tag },
|
||||
undef,
|
||||
WebGUI::Test->webguiBirthday,
|
||||
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
|
||||
);
|
||||
|
||||
my $second_thread = $collab->addChild(
|
||||
{ className => 'WebGUI::Asset::Post::Thread', %tag },
|
||||
undef,
|
||||
WebGUI::Test->webguiBirthday,
|
||||
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
|
||||
);
|
||||
|
||||
##Thread 1, Post 1 => t1p1
|
||||
|
|
@ -55,14 +53,12 @@ my $t1p1 = $first_thread->addChild(
|
|||
{ className => 'WebGUI::Asset::Post', %tag },
|
||||
undef,
|
||||
WebGUI::Test->webguiBirthday,
|
||||
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
|
||||
);
|
||||
|
||||
my $t1p2 = $first_thread->addChild(
|
||||
{ className => 'WebGUI::Asset::Post', %tag },
|
||||
undef,
|
||||
WebGUI::Test->webguiBirthday + 1,
|
||||
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
|
||||
);
|
||||
|
||||
my $past = time()-15;
|
||||
|
|
@ -71,16 +67,16 @@ my $t2p1 = $second_thread->addChild(
|
|||
{ className => 'WebGUI::Asset::Post', %tag },
|
||||
undef,
|
||||
$past,
|
||||
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
|
||||
);
|
||||
|
||||
my $t2p2 = $second_thread->addChild(
|
||||
{ className => 'WebGUI::Asset::Post', %tag },
|
||||
undef,
|
||||
undef,
|
||||
{ skipAutoCommitWorkflows => 1, skipNotification => 1 }
|
||||
);
|
||||
|
||||
foreach my $asset ($t1p1, $t1p2, $t2p1, $t2p2, $first_thread, $second_thread, ) {
|
||||
$asset->setSkipNotification;
|
||||
}
|
||||
|
||||
$versionTag->commit();
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ 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 ) );
|
||||
|
||||
# Override some settings to make things easier to test
|
||||
# userFunctionStyleId
|
||||
|
|
@ -55,13 +53,13 @@ my $testContent = "Perhaps if you've gone this far, you'd be willing to go f
|
|||
my $snippetUrl = time . "zejuatenejo";
|
||||
my $redirectToUrl = $snippetUrl . "?name=value";
|
||||
my $redirectToAsset
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => 'WebGUI::Asset::Snippet',
|
||||
url => $snippetUrl,
|
||||
snippet => $testContent,
|
||||
});
|
||||
$versionTags[-1]->commit;
|
||||
WebGUI::Test->addToCleanup($versionTags[-1]);
|
||||
);
|
||||
|
||||
my $count = time; # A known count for url uniqueness
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
|
@ -79,18 +77,15 @@ plan tests => 12; # Increment this number for each test you create
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test operation with a public Redirect
|
||||
push @versionTags, WebGUI::VersionTag->getWorking( $session );
|
||||
WebGUI::Test->addToCleanup($versionTags[-1]);
|
||||
$redirect
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => 'WebGUI::Asset::Redirect',
|
||||
redirectUrl => $redirectToUrl,
|
||||
url => $redirectUrl . scalar(@versionTags),
|
||||
});
|
||||
$versionTags[-1]->commit;
|
||||
url => $redirectUrl . $count++,
|
||||
);
|
||||
|
||||
$mech = Test::WWW::Mechanize->new;
|
||||
$mech->get_ok( $baseUrl . $redirectUrl . scalar(@versionTags), "We get the redirect" );
|
||||
$mech->get_ok( $baseUrl . $redirectUrl . $count, "We get the redirect" );
|
||||
$mech->content_contains( $testContent, "We made it to the snippet" );
|
||||
|
||||
$response = $mech->res->previous;
|
||||
|
|
@ -103,20 +98,17 @@ is(
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test operation with a private Redirect through a login
|
||||
push @versionTags, WebGUI::VersionTag->getWorking( $session );
|
||||
WebGUI::Test->addToCleanup($versionTags[-1]);
|
||||
$redirect
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => 'WebGUI::Asset::Redirect',
|
||||
redirectUrl => $redirectToUrl,
|
||||
url => $redirectUrl . scalar(@versionTags),
|
||||
url => $redirectUrl . $count++,
|
||||
groupIdView => 2,
|
||||
groupIdEdit => 3,
|
||||
});
|
||||
$versionTags[-1]->commit;
|
||||
);
|
||||
|
||||
$mech = Test::WWW::Mechanize->new;
|
||||
$mech->get( $baseUrl . $redirectUrl . scalar(@versionTags) );
|
||||
$mech->get( $baseUrl . $redirectUrl . $count );
|
||||
$mech->submit_form_ok( {
|
||||
with_fields => {
|
||||
username => $user->username,
|
||||
|
|
@ -137,22 +129,19 @@ is(
|
|||
#----------------------------------------------------------------------------
|
||||
# Test operation with a private Redirect through a login with translate
|
||||
# query params
|
||||
push @versionTags, WebGUI::VersionTag->getWorking( $session );
|
||||
WebGUI::Test->addToCleanup($versionTags[-1]);
|
||||
$redirect
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => 'WebGUI::Asset::Redirect',
|
||||
redirectUrl => $redirectToUrl,
|
||||
url => $redirectUrl . scalar(@versionTags),
|
||||
url => $redirectUrl . $count++,
|
||||
groupIdView => 2,
|
||||
groupIdEdit => 3,
|
||||
forwardQueryParams => 1,
|
||||
});
|
||||
$versionTags[-1]->commit;
|
||||
);
|
||||
|
||||
my $extraParams = 'extra=hi';
|
||||
$mech = Test::WWW::Mechanize->new;
|
||||
$mech->get( $baseUrl . $redirectUrl . scalar(@versionTags) . '?' . $extraParams );
|
||||
$mech->get( $baseUrl . $redirectUrl . $count . '?' . $extraParams );
|
||||
$mech->submit_form_ok( {
|
||||
with_fields => {
|
||||
username => $user->username,
|
||||
|
|
|
|||
|
|
@ -20,16 +20,12 @@ use WebGUI::Asset::Snippet;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Shortcut Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
||||
# Make a snippet to shortcut
|
||||
my $snippet
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Snippet",
|
||||
});
|
||||
);
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
|
@ -44,10 +40,10 @@ use_ok("WebGUI::Asset::Shortcut");
|
|||
# Test creating a shortcut to snippet
|
||||
# plan tests => 2
|
||||
my $shortcut
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Shortcut",
|
||||
shortcutToAssetId => $snippet->getId,
|
||||
});
|
||||
);
|
||||
|
||||
isa_ok(
|
||||
$shortcut, "WebGUI::Asset::Shortcut",
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ use WebGUI::Asset::Snippet;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
|
||||
my $snippet;
|
||||
my $shortcut;
|
||||
|
|
@ -144,18 +143,15 @@ ok(
|
|||
# init a new snippet and shortcut; handy to have in a sub because we destroy
|
||||
# them in some tests and need to reset them for the next round
|
||||
sub init {
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Shortcut Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
# Make a snippet to shortcut
|
||||
$snippet
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Snippet",
|
||||
});
|
||||
);
|
||||
|
||||
$shortcut
|
||||
= $node->addChild({
|
||||
= WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Shortcut",
|
||||
shortcutToAssetId => $snippet->getId,
|
||||
});
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@ use WebGUI::Asset::Snippet;
|
|||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Shortcut Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
# Make a snippet to shortcut
|
||||
my $now = time();
|
||||
my $snippet = $node->addChild({
|
||||
|
|
@ -42,7 +39,6 @@ my $shortcut = $node->addChild({
|
|||
shortcutToAssetId => $snippet->getId,
|
||||
},
|
||||
undef, $now-10);
|
||||
$versionTag->commit;
|
||||
$session->db->write(q|update assetData set lastModified=? where assetId=?|,[WebGUI::Test->webguiBirthday, $snippet->getId]);
|
||||
foreach my $asset ($snippet, $shortcut) {
|
||||
$asset = $asset->cloneFromDb;
|
||||
|
|
|
|||
|
|
@ -41,10 +41,10 @@ plan tests => 19; # Increment this number for each test you create
|
|||
# put your tests here
|
||||
my $node = WebGUI::Asset->getRoot($session);
|
||||
|
||||
my $product = $node->addChild({
|
||||
my $product = WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Sku::Product",
|
||||
title => "Rock Hammer",
|
||||
});
|
||||
);
|
||||
|
||||
is($product->getThumbnailUrl(), '', 'Product with no image1 property returns the empty string');
|
||||
|
||||
|
|
@ -59,12 +59,12 @@ WebGUI::Test->addToCleanup($image);
|
|||
$image->addFileFromFilesystem(WebGUI::Test->getTestCollateralPath('lamp.jpg'));
|
||||
$image->generateThumbnail('lamp.jpg');
|
||||
|
||||
my $imagedProduct = $node->addChild({
|
||||
my $imagedProduct = WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Sku::Product",
|
||||
title => "Bible",
|
||||
image1 => $image->getId,
|
||||
isShippingRequired => 1,
|
||||
});
|
||||
);
|
||||
|
||||
ok($imagedProduct->getThumbnailUrl(), 'getThumbnailUrl is not empty');
|
||||
is($imagedProduct->getThumbnailUrl(), $image->getThumbnailUrl('lamp.jpg'), 'getThumbnailUrl returns the right path to the URL');
|
||||
|
|
@ -114,32 +114,24 @@ cmp_deeply(
|
|||
'... form only has 1 variant, since the other one has 0 quantity'
|
||||
);
|
||||
|
||||
my $tag = WebGUI::VersionTag->getWorking($session);
|
||||
$tag->commit;
|
||||
WebGUI::Test->addToCleanup($tag);
|
||||
|
||||
####################################################
|
||||
#
|
||||
# addRevision
|
||||
#
|
||||
####################################################
|
||||
|
||||
sleep 2;
|
||||
my $newImagedProduct = $imagedProduct->addRevision({title => 'Bible and hammer'});
|
||||
my $newImagedProduct = $imagedProduct->addRevision({title => 'Bible and hammer'},time+2);
|
||||
|
||||
like($newImagedProduct->get('image1'), $session->id->getValidator, 'addRevision: new product rev got an image1 storage location');
|
||||
isnt($newImagedProduct->get('image1'), $imagedProduct->get('image1'), '... and it is not the same as the old one');
|
||||
|
||||
WebGUI::Test->addToCleanup(WebGUI::VersionTag->getWorking($session));
|
||||
WebGUI::VersionTag->getWorking($session)->commit;
|
||||
|
||||
####################################################
|
||||
#
|
||||
# view, template variables
|
||||
#
|
||||
####################################################
|
||||
|
||||
my $jsonTemplate = $node->addChild({
|
||||
my $jsonTemplate = WebGUI::Test->asset(
|
||||
className => 'WebGUI::Asset::Template',
|
||||
title => 'JSON template for Product testing',
|
||||
template => q|
|
||||
|
|
@ -152,25 +144,18 @@ my $jsonTemplate = $node->addChild({
|
|||
"manual_url" :"<tmpl_var manual_url>"
|
||||
}
|
||||
|,
|
||||
});
|
||||
);
|
||||
|
||||
my @storages = map { WebGUI::Storage->create($session) } 0..2;
|
||||
|
||||
my $viewProduct = $node->addChild({
|
||||
my $viewProduct = WebGUI::Test->asset(
|
||||
className => 'WebGUI::Asset::Sku::Product',
|
||||
title => 'View Product for template variable tests',
|
||||
templateId => $jsonTemplate->getId,
|
||||
brochure => $storages[0]->getId,
|
||||
warranty => $storages[1]->getId,
|
||||
manual => $storages[2]->getId,
|
||||
});
|
||||
|
||||
my $tag2 = WebGUI::VersionTag->getWorking($session);
|
||||
$tag2->commit;
|
||||
WebGUI::Test->addToCleanup($tag2);
|
||||
|
||||
##Fetch a copy from the db, just like a page fetch
|
||||
$viewProduct = WebGUI::Asset->newById($session, $viewProduct->getId);
|
||||
);
|
||||
|
||||
$viewProduct->prepareView();
|
||||
my $json = $viewProduct->view();
|
||||
|
|
|
|||
|
|
@ -33,22 +33,19 @@ plan tests => 4; # Increment this number for each test you create
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# put your tests here
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
my $group = WebGUI::Group->new($session, 'new');
|
||||
WebGUI::Test->addToCleanup($group);
|
||||
my $user = WebGUI::User->create($session);
|
||||
WebGUI::Test->addToCleanup($user);
|
||||
|
||||
my $sku = $root->addChild({
|
||||
my $sku = WebGUI::Test->asset(
|
||||
className => "WebGUI::Asset::Sku::Subscription",
|
||||
title => "Test Subscription",
|
||||
price => 50.00,
|
||||
recurringSubscription => 0,
|
||||
subscriptionGroup => $group->getId,
|
||||
duration => 'Monthly',
|
||||
});
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
);
|
||||
isa_ok($sku, "WebGUI::Asset::Sku::Subscription");
|
||||
|
||||
is($sku->getPrice, 50.00, "Price should be 50.00");
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ $canEditMaker->prepare({
|
|||
});
|
||||
|
||||
|
||||
my $defaultNode = WebGUI::Asset->getDefault($session);
|
||||
my $defaultNode = WebGUI::Test->asset;
|
||||
my $archive = $defaultNode->addChild({
|
||||
className => 'WebGUI::Asset::Wobject::StoryArchive',
|
||||
title => 'Test Archive',
|
||||
|
|
@ -66,12 +66,6 @@ my $topic = $defaultNode->addChild({
|
|||
assetId => 'TestStoryTopicAsset123',
|
||||
keywords => 'tango,yankee',
|
||||
});
|
||||
my $archiveTag = WebGUI::VersionTag->getWorking($session);
|
||||
$archiveTag->commit;
|
||||
WebGUI::Test->addToCleanup($archiveTag);
|
||||
foreach my $asset ($archive, $topic) {
|
||||
$asset = $asset->cloneFromDb;
|
||||
}
|
||||
|
||||
my $storage1 = WebGUI::Storage->create($session);
|
||||
my $storage2 = WebGUI::Storage->create($session);
|
||||
|
|
@ -125,15 +119,7 @@ is($story->isHidden, 1, 'by default, stories are hidden');
|
|||
$story->update({isHidden => 0});
|
||||
is($story->isHidden, 1, 'stories cannot be set to not be hidden');
|
||||
is($story->state, 'published', 'Story is published');
|
||||
$story->requestAutoCommit;
|
||||
|
||||
{
|
||||
##Version control does not alter the current object's status, fetch an updated copy from the
|
||||
##db.
|
||||
my $storyDB = $story->cloneFromDb;
|
||||
is($storyDB->status, 'approved', 'Story is approved');
|
||||
}
|
||||
|
||||
$story->commit;
|
||||
|
||||
############################################################
|
||||
#
|
||||
|
|
|
|||
|
|
@ -34,8 +34,7 @@ SKIP: {
|
|||
skip "HTML::Template::Expr or plugin not loaded", $num_tests unless $plugin;
|
||||
|
||||
$session->config->set('templateParsers', ['WebGUI::Asset::Template::HTMLTemplate', 'WebGUI::Asset::Template::HTMLTemplateExpr',] );
|
||||
my ($versionTag, $template) = setup_assets($session);
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $template = setup_assets($session);
|
||||
my $templateOutput = $template->process({ "foo.bar" => "baz", "number.value" => 2 });
|
||||
my $companyName = $session->config->get('companyName');
|
||||
like($templateOutput, qr/NAME=$companyName/, "session variable with underscores");
|
||||
|
|
@ -45,9 +44,6 @@ SKIP: {
|
|||
|
||||
sub setup_assets {
|
||||
my $session = shift;
|
||||
my $importNode = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"HTMLTemplateExpr test"});
|
||||
my $properties = {
|
||||
title => 'HTML Template Expr test',
|
||||
className => 'WebGUI::Asset::Template',
|
||||
|
|
@ -57,7 +53,6 @@ sub setup_assets {
|
|||
# '1234567890123456789012'
|
||||
template => q!NAME=<tmpl_var session_setting_companyName>\nFOOBAR=<tmpl_var name="foo_bar">\nEQN=<tmpl_var EXPR="2+number_value">!,
|
||||
};
|
||||
my $template = $importNode->addChild($properties, $properties->{id});
|
||||
$versionTag->commit;
|
||||
return ($versionTag, $template);
|
||||
my $template = WebGUI::Test->asset->addChild($properties, $properties->{id});
|
||||
return $template;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,18 +21,16 @@ use WebGUI::Asset::WikiPage;
|
|||
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $node = WebGUI::Test->asset;
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Wiki Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
||||
my $wiki = $node->addChild({className=>'WebGUI::Asset::Wobject::WikiMaster', title => 'Wiki Test', url => 'wikitest'});
|
||||
my %tag = ( tagId => $versionTag->getId, status => "pending" );
|
||||
my $wiki = $node->addChild({className=>'WebGUI::Asset::Wobject::WikiMaster', title => 'Wiki Test', url => 'wikitest',});
|
||||
my @autoCommitCoda = (undef, undef, {skipAutoCommitWorkflows => 1, skipNotification => 1});
|
||||
$versionTag->commit;
|
||||
my $wiki = $wiki->cloneFromDb;
|
||||
my $wikipage = $wiki->addChild(
|
||||
{className=>'WebGUI::Asset::WikiPage',
|
||||
title =>'wikipage'},
|
||||
title =>'wikipage', %tag},
|
||||
@autoCommitCoda,
|
||||
);
|
||||
|
||||
|
|
@ -51,8 +49,6 @@ my $wikiPageCopy = $wikipage->duplicate();
|
|||
$wikiPageCopy = $wikiPageCopy->cloneFromDb;
|
||||
$wikiPageCopy->update({ title => 'wikipage copy', });
|
||||
isa_ok($wikiPageCopy, 'WebGUI::Asset::WikiPage');
|
||||
my $thirdVersionTag = WebGUI::VersionTag->new($session,$wikiPageCopy->get("tagId"));
|
||||
WebGUI::Test->addToCleanup($thirdVersionTag);
|
||||
|
||||
## isProtected
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use WebGUI::Session;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $import = WebGUI::Asset->getImportNode( $session );
|
||||
my $import = WebGUI::Test->asset;
|
||||
my $wiki
|
||||
= $import->addChild( {
|
||||
className => 'WebGUI::Asset::Wobject::WikiMaster',
|
||||
|
|
@ -32,9 +32,7 @@ my $wiki
|
|||
my $page
|
||||
= $wiki->addChild( {
|
||||
className => 'WebGUI::Asset::WikiPage',
|
||||
}, undef, undef, { skipAutoCommitWorkflows => 1 } );
|
||||
|
||||
WebGUI::Test->addToCleanup( WebGUI::VersionTag->getWorking( $session ) );
|
||||
} );
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
|
@ -49,7 +47,4 @@ ok( my $template = $page->getSubscriptionTemplate, 'getSubscriptionTemplate retu
|
|||
isa_ok( $template, 'WebGUI::Asset::Template', 'getSubscriptionTemplate' );
|
||||
is( $template->getId, 'limMkk80fMB3fqNZVf162w', 'getSubscriptionTemplate gets wikimaster template' );
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Cleanup
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use WebGUI::Asset::Wobject::Article;
|
|||
my $session = WebGUI::Test->session;
|
||||
|
||||
# Do our work in the import node
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $node = WebGUI::Test->asset;
|
||||
|
||||
# Lets create an article wobject using all defaults then test to see if those defaults were set
|
||||
#
|
||||
|
|
@ -36,9 +36,6 @@ my $node = WebGUI::Asset->getImportNode($session);
|
|||
# storageId => undef,
|
||||
#};
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Article Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $article = $node->addChild({className=>'WebGUI::Asset::Wobject::Article'});
|
||||
|
||||
# Test for a sane object type
|
||||
|
|
|
|||
|
|
@ -60,18 +60,13 @@ plan tests => 12 + scalar @icalWrapTests;
|
|||
my $session = WebGUI::Test->session;
|
||||
|
||||
# Do our work in the import node
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Calendar Test"});
|
||||
addToCleanup($versionTag);
|
||||
my $node = WebGUI::Test->asset;
|
||||
|
||||
my $cal = $node->addChild({className=>'WebGUI::Asset::Wobject::Calendar'});
|
||||
my $windowCal = $node->addChild({
|
||||
className => 'WebGUI::Asset::Wobject::Calendar',
|
||||
title => 'Calendar for doing event window testing',
|
||||
});
|
||||
$versionTag->commit();
|
||||
|
||||
# Test for a sane object type
|
||||
isa_ok($cal, 'WebGUI::Asset::Wobject::Calendar');
|
||||
|
|
@ -125,13 +120,17 @@ my $windowStart = $startDt->clone;
|
|||
my $endDt = $startDt->clone->add(days => 2);
|
||||
my $windowEnd = $endDt->clone->subtract(seconds => 1);
|
||||
|
||||
my $tag2 = WebGUI::VersionTag->getWorking($session);
|
||||
my %tag = ( tagId => $tag2->getId, status => "pending" );
|
||||
|
||||
my $inside = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
title => 'Inside window, no times, same day',
|
||||
startDate => $bday->toDatabaseDate,
|
||||
endDate => $bday->toDatabaseDate,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
},);
|
||||
|
||||
my $insidewt = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -141,7 +140,8 @@ my $insidewt = $windowCal->addChild({
|
|||
startTime => $bday->toDatabaseTime,
|
||||
endTime => $bday->clone->add(hours => 1)->toDatabaseTime,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
},);
|
||||
|
||||
my $outsideHigh = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -149,7 +149,8 @@ my $outsideHigh = $windowCal->addChild({
|
|||
startDate => $endDt->clone->add(days => 2)->toDatabaseDate,
|
||||
endDate => $endDt->clone->add(days => 3)->toDatabaseDate,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
},);
|
||||
|
||||
my $outsideLow = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -157,7 +158,8 @@ my $outsideLow = $windowCal->addChild({
|
|||
startDate => $startDt->clone->subtract(days => 3)->toDatabaseDate,
|
||||
endDate => $startDt->clone->subtract(days => 2)->toDatabaseDate,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
},);
|
||||
|
||||
my $straddle = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -165,7 +167,8 @@ my $straddle = $windowCal->addChild({
|
|||
startDate => $startDt->clone->subtract(days => 1)->toDatabaseDate,
|
||||
endDate => $endDt->clone->add(days => 1)->toDatabaseDate,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
},);
|
||||
|
||||
my $straddlewt = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -175,7 +178,8 @@ my $straddlewt = $windowCal->addChild({
|
|||
startTime => $startDt->clone->subtract(hours => 12)->toDatabaseTime,
|
||||
endTime => $endDt->clone->add(hours => 12)->toDatabaseTime,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
},);
|
||||
|
||||
my $straddleLowwt = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -185,7 +189,8 @@ my $straddleLowwt = $windowCal->addChild({
|
|||
startTime => $startDt->clone->subtract(hours => 12)->toDatabaseTime,
|
||||
endTime => $startDt->clone->add(hours => 12)->toDatabaseTime,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
},);
|
||||
|
||||
my $straddleHighwt = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -195,7 +200,8 @@ my $straddleHighwt = $windowCal->addChild({
|
|||
startTime => $endDt->clone->subtract(hours => 12)->toDatabaseTime,
|
||||
endTime => $endDt->clone->add(hours => 12)->toDatabaseTime,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
},);
|
||||
|
||||
my $justBeforewt = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -205,7 +211,8 @@ my $justBeforewt = $windowCal->addChild({
|
|||
startTime => $startDt->clone->subtract(hours => 1)->toDatabaseTime,
|
||||
endTime => $startDt->toDatabaseTime,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
},);
|
||||
|
||||
my $justAfterwt = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -215,7 +222,8 @@ my $justAfterwt = $windowCal->addChild({
|
|||
startTime => $endDt->toDatabaseTime,
|
||||
endTime => $endDt->clone->add(hours => 1)->toDatabaseTime,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
}, );
|
||||
|
||||
my $justBefore = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -223,7 +231,8 @@ my $justBefore = $windowCal->addChild({
|
|||
startDate => $startDt->clone->add(days => -1)->toDatabaseDate,
|
||||
endDate => $startDt->clone->add(days => -1)->toDatabaseDate,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
},);
|
||||
|
||||
my $justAfter = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -231,7 +240,8 @@ my $justAfter = $windowCal->addChild({
|
|||
startDate => $endDt->clone->add(days => 1)->toDatabaseDate,
|
||||
endDate => $endDt->clone->add(days => 1)->toDatabaseDate,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
},);
|
||||
|
||||
my $starting = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -239,7 +249,8 @@ my $starting = $windowCal->addChild({
|
|||
startDate => $startDt->toDatabaseDate,
|
||||
endDate => $startDt->toDatabaseDate,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
}, );
|
||||
|
||||
my $ending = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -247,7 +258,8 @@ my $ending = $windowCal->addChild({
|
|||
startDate => $endDt->clone->add(days => -1)->toDatabaseDate,
|
||||
endDate => $endDt->clone->add(days => -1)->toDatabaseDate,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
},);
|
||||
|
||||
my $coincident = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -255,7 +267,8 @@ my $coincident = $windowCal->addChild({
|
|||
startDate => $startDt->toDatabaseDate,
|
||||
endDate => $endDt->toDatabaseDate,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
},);
|
||||
|
||||
my $coincidentLow = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -263,7 +276,8 @@ my $coincidentLow = $windowCal->addChild({
|
|||
startDate => $startDt->toDatabaseDate,
|
||||
endDate => $endDt->clone->add(days => 1)->toDatabaseDate,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
},);
|
||||
|
||||
my $coincidentHigh = $windowCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -271,7 +285,8 @@ my $coincidentHigh = $windowCal->addChild({
|
|||
startDate => $startDt->clone->add( days => -1, )->toDatabaseDate,
|
||||
endDate => $endDt->toDatabaseDate,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
%tag,
|
||||
},);
|
||||
|
||||
# no suffix = all day event
|
||||
# wt suffix = with times
|
||||
|
|
@ -294,7 +309,6 @@ my $coincidentHigh = $windowCal->addChild({
|
|||
#
|
||||
# Everything above the window should be included in the set of events returned.
|
||||
|
||||
my $tag2 = WebGUI::VersionTag->getWorking($session);
|
||||
$tag2->commit;
|
||||
addToCleanup($tag2);
|
||||
|
||||
|
|
@ -338,7 +352,7 @@ my $allDay = $weekCal->addChild({
|
|||
startTime => $allDayDt->clone->truncate(to => 'day')->toDatabaseTime,
|
||||
endTime => $allDayDt->clone->add(days => 1)->truncate(to => 'day')->toDatabaseTime,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
}, );
|
||||
|
||||
my $endOfWeek = $weekCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -348,11 +362,7 @@ my $endOfWeek = $weekCal->addChild({
|
|||
startTime => $nextWeekDt->toDatabaseTime,
|
||||
endTime => $nextWeekDt->clone->add(hours => 1)->toDatabaseTime,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
|
||||
my $tag3 = WebGUI::VersionTag->getWorking($session);
|
||||
$tag3->commit;
|
||||
addToCleanup($tag3);
|
||||
}, );
|
||||
|
||||
my $weekVars = $weekCal->viewWeek({ start => $bday });
|
||||
my @eventBins = ();
|
||||
|
|
@ -418,7 +428,7 @@ $allDay = $monthCal->addChild({
|
|||
startTime => $allDayDt->clone->truncate(to => 'day')->toDatabaseTime,
|
||||
endTime => $allDayDt->clone->add(days => 1)->truncate(to => 'day')->toDatabaseTime,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
},);
|
||||
|
||||
my $endOfMonth = $monthCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -428,11 +438,7 @@ my $endOfMonth = $monthCal->addChild({
|
|||
startTime => $nextMonthDt->toDatabaseTime,
|
||||
endTime => $nextMonthDt->clone->add(hours => 1)->toDatabaseTime,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
|
||||
my $tag4 = WebGUI::VersionTag->getWorking($session);
|
||||
$tag4->commit;
|
||||
addToCleanup($tag4);
|
||||
}, );
|
||||
|
||||
my $monthVars = $monthCal->viewMonth({ start => $bday });
|
||||
@eventBins = ();
|
||||
|
|
@ -489,7 +495,7 @@ $allDay = $dayCal->addChild({
|
|||
startTime => $allDayDt->clone->truncate(to => 'day')->toDatabaseTime,
|
||||
endTime => $allDayDt->clone->add(days => 1)->truncate(to => 'day')->toDatabaseTime,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
}, );
|
||||
|
||||
my $nextDay = $dayCal->addChild({
|
||||
className => 'WebGUI::Asset::Event',
|
||||
|
|
@ -499,11 +505,7 @@ my $nextDay = $dayCal->addChild({
|
|||
startTime => $nextDayDt->toDatabaseTime,
|
||||
endTime => $nextDayDt->clone->add(hours => 1)->toDatabaseTime,
|
||||
timeZone => $tz,
|
||||
}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
|
||||
my $tag5 = WebGUI::VersionTag->getWorking($session);
|
||||
$tag5->commit;
|
||||
addToCleanup($tag5);
|
||||
},);
|
||||
|
||||
my $hourVars = $dayCal->viewDay({ start => $nextDayDt });
|
||||
@eventBins = ();
|
||||
|
|
@ -583,11 +585,6 @@ my $feedCal = $node->addChild({
|
|||
title => 'Calendar for doing feed tests',
|
||||
});
|
||||
|
||||
my $feedTag = WebGUI::VersionTag->getWorking($session);
|
||||
$feedTag->set({name=>"Calendar Feed Test"});
|
||||
addToCleanup($feedTag);
|
||||
$feedTag->commit;
|
||||
|
||||
cmp_deeply(
|
||||
$feedCal->getFeeds(),
|
||||
[],
|
||||
|
|
|
|||
|
|
@ -20,11 +20,7 @@ use WebGUI::Asset::Wobject::Carousel;
|
|||
my $session = WebGUI::Test->session;
|
||||
|
||||
# Do our work in the import node
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Search Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $node = WebGUI::Test->asset;
|
||||
my $carousel = $node->addChild({className=>'WebGUI::Asset::Wobject::Carousel'});
|
||||
|
||||
# Test for a sane object type
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ my @addChildCoda = (undef, undef,
|
|||
);
|
||||
|
||||
# Do our work in the import node
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $node = WebGUI::Test->asset;
|
||||
|
||||
# grab a named version tag
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
|
|
@ -72,6 +72,7 @@ my $props = {
|
|||
tagId => $tag1->getId,
|
||||
};
|
||||
my $thread = $collab->addChild($props, @addChildCoda);
|
||||
$thread->setSkipNotification;
|
||||
$tag1->commit;
|
||||
addToCleanup($tag1);
|
||||
|
||||
|
|
@ -86,6 +87,7 @@ $props = {
|
|||
tagId => $tag2->getId,
|
||||
};
|
||||
my $thread2 = $collab->addChild($props, @addChildCoda);
|
||||
$thread2->setSkipNotification;
|
||||
$tag2->commit;
|
||||
addToCleanup($tag2);
|
||||
|
||||
|
|
@ -115,6 +117,7 @@ my $thread3 = $collab->addChild({
|
|||
className => 'WebGUI::Asset::Post::Thread',
|
||||
content => "Again!",
|
||||
}, @addChildCoda);
|
||||
$thread->setSkipNotification;
|
||||
$thread3->commit;
|
||||
$collab = $collab->cloneFromDb;
|
||||
is $collab->get('threads'), 2, '... added 1 thread';
|
||||
|
|
|
|||
|
|
@ -22,10 +22,7 @@ use WebGUI::Session;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my @versionTags = ( WebGUI::VersionTag->getWorking( $session ) );
|
||||
WebGUI::Test->addToCleanup($versionTags[-1]);
|
||||
my @addChildArgs = ( {skipAutoCommitWorkflows=>1} );
|
||||
my $collab = WebGUI::Asset->getImportNode( $session )->addChild({
|
||||
my $collab = WebGUI::Test->asset->addChild({
|
||||
className => 'WebGUI::Asset::Wobject::Collaboration',
|
||||
threadsPerPage => 20,
|
||||
});
|
||||
|
|
@ -36,29 +33,28 @@ my @threads = (
|
|||
title => "X - Foo",
|
||||
isSticky => 0,
|
||||
threadRating => 4,
|
||||
}, undef, 1, @addChildArgs),
|
||||
}, undef, 1, ),
|
||||
$collab->addChild( {
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
title => "W - Bar",
|
||||
isSticky => 0,
|
||||
threadRating => 2,
|
||||
}, undef, 2, @addChildArgs),
|
||||
}, undef, 2, ),
|
||||
$collab->addChild( {
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
title => "Z - Baz",
|
||||
isSticky => 1,
|
||||
threadRating => 6,
|
||||
}, undef, 3, @addChildArgs),
|
||||
}, undef, 3, ),
|
||||
$collab->addChild( {
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
title => "Y - Shank",
|
||||
isSticky => 1,
|
||||
threadRating => 5,
|
||||
}, undef, 4, @addChildArgs),
|
||||
}, undef, 4, ),
|
||||
);
|
||||
|
||||
$_->setSkipNotification for @threads; # 100+ messages later...
|
||||
$versionTags[-1]->commit;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
|
|
|||
|
|
@ -24,19 +24,13 @@ use WebGUI::Test::Maker::Permission;
|
|||
my $session = WebGUI::Test->session;
|
||||
$session->user( { userId => 3 } );
|
||||
my $maker = WebGUI::Test::Maker::Permission->new;
|
||||
my $node = WebGUI::Asset->getImportNode( $session );
|
||||
my $node = WebGUI::Test->asset;
|
||||
|
||||
my %user;
|
||||
$user{"2"} = WebGUI::User->new( $session, "new" );
|
||||
$user{"2"}->addToGroups( ['2'] ); # Registered user
|
||||
WebGUI::Test->addToCleanup($user{'2'});
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking( $session );
|
||||
$versionTag->set( { name => "Collaboration Test" } );
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
||||
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1 } );
|
||||
|
||||
my $collab
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Collaboration",
|
||||
|
|
@ -45,12 +39,7 @@ my $collab
|
|||
ownerUserId => 3, # Admin
|
||||
postGroupId => 2, # Registered Users
|
||||
canStartThreadGroupId => 3, # Admin
|
||||
}, @addArgs );
|
||||
|
||||
$versionTag->commit( { timeout => 1_000_000 } );
|
||||
|
||||
# Re-load the collab to get the newly committed properties
|
||||
$collab = WebGUI::Asset->newById( $session, $collab->getId );
|
||||
},);
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
|
|
|||
|
|
@ -27,8 +27,7 @@ plan tests => 23; # Increment this number for each test you create
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my @addChildArgs = ( {skipAutoCommitWorkflows=>1, skipNotification => 1, } );
|
||||
my $collab = WebGUI::Asset->getImportNode( $session )->addChild({
|
||||
my $collab = WebGUI::Test->asset->addChild({
|
||||
className => 'WebGUI::Asset::Wobject::Collaboration',
|
||||
threadsPerPage => 20,
|
||||
displayLastReply => 1,
|
||||
|
|
@ -40,19 +39,19 @@ my @threads = (
|
|||
title => "X - Foo",
|
||||
isSticky => 0,
|
||||
ownerUserId => 1,
|
||||
}, undef, 1, @addChildArgs),
|
||||
}, undef, 1,),
|
||||
$collab->addChild( {
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
title => "X - Bar",
|
||||
isSticky => 0,
|
||||
ownerUserId => 3,
|
||||
}, undef, 2, @addChildArgs),
|
||||
}, undef, 2,),
|
||||
);
|
||||
|
||||
$_->setSkipNotification for @threads; # 100+ messages later...
|
||||
my $versionTag = WebGUI::VersionTag->getWorking( $session );
|
||||
$versionTag->commit;
|
||||
addToCleanup($versionTag);
|
||||
for my $t ( @threads ) {
|
||||
$t->setSkipNotification;
|
||||
$t->commit;
|
||||
}
|
||||
|
||||
my $templateVars;
|
||||
my $posts;
|
||||
|
|
@ -98,18 +97,20 @@ is( $posts->[0]->{'url'}, $threads[1]->getUrl.'#id'.$threads[1]->getId, 'url ha
|
|||
###################################################################
|
||||
|
||||
my @newThreads = ();
|
||||
my $vt2 = WebGUI::VersionTag->getWorking($session);
|
||||
foreach my $index (1 .. 5) {
|
||||
$newThreads[$index] = $collab->addChild( {
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
title => "X - Bar",
|
||||
isSticky => 0,
|
||||
ownerUserId => 3,
|
||||
}, undef, 2+$index, @addChildArgs);
|
||||
tagId => $vt2->getId,
|
||||
status => "pending",
|
||||
}, undef, 2+$index);
|
||||
$newThreads[$index]->setSkipNotification;
|
||||
}
|
||||
my $vt2 = WebGUI::VersionTag->getWorking($session);
|
||||
$vt2->commit;
|
||||
addToCleanup($versionTag);
|
||||
addToCleanup($vt2);
|
||||
|
||||
$session->user({userId => 3});
|
||||
$templateVars = $collab->getViewTemplateVars();
|
||||
|
|
|
|||
|
|
@ -38,7 +38,10 @@ my @threads = (
|
|||
groupIdEdit => '3',
|
||||
}),
|
||||
);
|
||||
$_->commit for @threads;
|
||||
for my $t ( @threads ) {
|
||||
$t->setSkipNotification;
|
||||
$t->commit;
|
||||
}
|
||||
|
||||
WebGUI::Test->addToCleanup($collab,@threads);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,23 +27,19 @@ use WebGUI::Session;
|
|||
my $session = WebGUI::Test->session;
|
||||
|
||||
# Create a DataForm
|
||||
my $df = WebGUI::Asset->getImportNode( $session )
|
||||
my $df = WebGUI::Test->asset
|
||||
->addChild( {
|
||||
className => "WebGUI::Asset::Wobject::DataForm",
|
||||
mailData => 0,
|
||||
fieldConfiguration => '[]',
|
||||
} );
|
||||
}, undef, time-10 );
|
||||
|
||||
my $dform = WebGUI::Asset->getDefault($session)->addChild({
|
||||
my $dform = WebGUI::Test->asset->addChild({
|
||||
className => "WebGUI::Asset::Wobject::DataForm",
|
||||
mailData => 0,
|
||||
});
|
||||
}, undef, time-5);
|
||||
$dform->createField('gotCaptcha', { type => 'Captcha', name => 'humanCheck', });
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
$versionTag->commit;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
|
|
@ -69,7 +65,7 @@ WebGUI::Test->interceptLogging( sub {
|
|||
#----------------------------------------------------------------------------
|
||||
# getContentLastModified
|
||||
|
||||
sleep 3;
|
||||
sleep 3; # whyyyyyyyy
|
||||
|
||||
$df->{_mode} = 'form';
|
||||
is($df->getContentLastModified, $df->get('lastModified'), 'getContentLastModified: form normally returns lastModified');
|
||||
|
|
|
|||
|
|
@ -23,12 +23,10 @@ use WebGUI::Session;
|
|||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $df = WebGUI::Asset->getImportNode($session)->addChild( {
|
||||
my $df = WebGUI::Test->asset->addChild( {
|
||||
className => 'WebGUI::Asset::Wobject::DataForm',
|
||||
} );
|
||||
|
||||
WebGUI::Test->addToCleanup( WebGUI::VersionTag->getWorking( $session ) );
|
||||
|
||||
# Add fields to the dataform
|
||||
$df->createField( "name", { type => "text", } );
|
||||
$df->createField( "message", { type => "text", } );
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ use WebGUI::Session;
|
|||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $df = WebGUI::Asset->getImportNode($session)->addChild( {
|
||||
my $df = WebGUI::Test->asset->addChild( {
|
||||
className => 'WebGUI::Asset::Wobject::DataForm',
|
||||
defaultview => 0,
|
||||
templateId => 'PBtmpl0000000000000141',
|
||||
|
|
@ -35,12 +35,6 @@ my $df = WebGUI::Asset->getImportNode($session)->addChild( {
|
|||
$df->createField( "bigName", { type => "textarea", isHidden => 0, } );
|
||||
$df->createField( "messageCount", { type => "integer", isHidden => 0, } );
|
||||
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
WebGUI::Test->addToCleanup( $tag );
|
||||
$tag->commit;
|
||||
|
||||
$df = $df->cloneFromDb;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
|
|
|
|||
|
|
@ -23,12 +23,10 @@ use WebGUI::Session;
|
|||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $df = WebGUI::Asset->getImportNode($session)->addChild( {
|
||||
my $df = WebGUI::Test->asset->addChild( {
|
||||
className => 'WebGUI::Asset::Wobject::DataForm',
|
||||
} );
|
||||
|
||||
WebGUI::Test->addToCleanup( WebGUI::VersionTag->getWorking( $session ) );
|
||||
|
||||
# Add fields to the dataform
|
||||
$df->createField( "name", { type => "text", } );
|
||||
$df->createField( "message", { type => "text", } );
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ $registrars->addUsers([$registrar->getId]);
|
|||
$attendees->addUsers([$attender->getId]);
|
||||
|
||||
# Do our work in the import node
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $node = WebGUI::Test->asset;
|
||||
|
||||
# Create a version tag to work in
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
|
|
|
|||
|
|
@ -20,10 +20,7 @@ use Test::More;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Gallery Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $node = WebGUI::Test->asset;
|
||||
my $maker = WebGUI::Test::Maker::Permission->new;
|
||||
my $gallery;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,7 @@ use Test::More;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Album Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $node = WebGUI::Test->asset;
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
|
|
@ -42,16 +39,8 @@ use_ok("WebGUI::Asset::Wobject::GalleryAlbum");
|
|||
my $album
|
||||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
$versionTag->commit;
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
||||
is(
|
||||
Scalar::Util::blessed($album), "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
"Album is a WebGUI::Asset::Wobject::GalleryAlbum object",
|
||||
|
|
|
|||
|
|
@ -21,9 +21,7 @@ use WebGUI::Asset::Wobject::GalleryAlbum;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $node = WebGUI::Test->asset;
|
||||
|
||||
my %user;
|
||||
$user{'1'} = WebGUI::User->new( $session, "new" );
|
||||
|
|
@ -35,27 +33,15 @@ WebGUI::Test->addToCleanup($user{'2'});
|
|||
# Create everything as user no. 1
|
||||
$session->user({ user => $user{'1'} });
|
||||
|
||||
$versionTag->set({name=>"Album Test"});
|
||||
|
||||
# Create gallery and a single album
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
groupIdEdit => 3, # Admins
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
my $album
|
||||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
# Create 5 photos inside the gallery
|
||||
|
|
@ -66,19 +52,10 @@ for (my $i = 0; $i < 5; $i++)
|
|||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
$photoId[$i] = $photo->getId;
|
||||
}
|
||||
|
||||
# Commit all changes
|
||||
$versionTag->commit;
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
||||
# Make album default asset
|
||||
$session->asset( $album );
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,7 @@ use Test::More;
|
|||
my $maker = WebGUI::Test::Maker::HTML->new;
|
||||
my $session = WebGUI::Test->session;
|
||||
$session->user({ userId => 3 });
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Album Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $node = WebGUI::Test->asset;
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
|
|
@ -40,19 +37,8 @@ my $album
|
|||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
ownerUserId => "3", # Admin
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
$versionTag->commit;
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
foreach my $asset ($gallery, $album) {
|
||||
$asset = $asset->cloneFromDb;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
plan tests => 5;
|
||||
|
|
|
|||
|
|
@ -19,51 +19,28 @@ 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"});
|
||||
my $node = WebGUI::Test->asset;
|
||||
|
||||
# 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;
|
||||
|
|
|
|||
|
|
@ -21,16 +21,13 @@ use WebGUI::Test::Maker::Permission;
|
|||
# Init
|
||||
my $maker = WebGUI::Test::Maker::Permission->new;
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $node = WebGUI::Test->asset;
|
||||
|
||||
my %user;
|
||||
$user{"2"} = WebGUI::User->new( $session, "new" );
|
||||
$user{"2"}->addToGroups( ['2'] ); # Registered user
|
||||
WebGUI::Test->addToCleanup($user{'2'});
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Album Test"});
|
||||
addToCleanup($versionTag);
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
|
|
@ -44,15 +41,8 @@ my $album
|
|||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
ownerUserId => "3", # Admin
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
|
||||
$versionTag->commit;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
plan tests => 36;
|
||||
|
|
|
|||
|
|
@ -22,9 +22,7 @@ use WebGUI::Test::Maker::HTML;
|
|||
# Init
|
||||
my $maker = WebGUI::Test::Maker::HTML->new;
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Album Test"});
|
||||
my $node = WebGUI::Test->asset;
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
|
|
@ -38,11 +36,6 @@ my $album
|
|||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
ownerUserId => "3", # Admin
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
my @photos;
|
||||
for my $i ( 0 .. 5 ) {
|
||||
|
|
@ -50,17 +43,9 @@ for my $i ( 0 .. 5 ) {
|
|||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
filename => "$i.jpg",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
}
|
||||
|
||||
$versionTag->commit;
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
plan tests => 1;
|
||||
|
|
|
|||
|
|
@ -22,10 +22,7 @@ use WebGUI::Test::Maker::HTML;
|
|||
# Init
|
||||
my $maker = WebGUI::Test::Maker::HTML->new;
|
||||
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"});
|
||||
my $node = WebGUI::Test->asset;
|
||||
my $gallery
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
|
|
@ -39,11 +36,6 @@ my $album
|
|||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
ownerUserId => "3", # Admin
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
my @photos;
|
||||
for my $i ( 0 .. 5 ) {
|
||||
|
|
@ -51,16 +43,9 @@ for my $i ( 0 .. 5 ) {
|
|||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
filename => "$i.jpg",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
{
|
||||
skipAutoCommitWorkflows => 1,
|
||||
});
|
||||
}
|
||||
|
||||
$versionTag->commit;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
plan tests => 1;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ SKIP: {
|
|||
skip "Unable to load module $class", $tests unless $loaded;
|
||||
|
||||
|
||||
my $defaultNode = WebGUI::Asset->getDefault($session);
|
||||
my $defaultNode = WebGUI::Test->asset;
|
||||
my $template = $defaultNode->addChild({
|
||||
className => 'WebGUI::Asset::Template',
|
||||
title => 'test poll template',
|
||||
|
|
@ -74,10 +74,6 @@ my $poll = $defaultNode->addChild({
|
|||
graphConfiguration => '{"graph_labelFontSize":"20","xyGraph_chartWidth":"200","xyGraph_drawRulers":"1","graph_labelColor":"#333333","xyGraph_drawAxis":"1","graph_formNamespace":"Graph_XYGraph_Bar","graph_backgroundColor":"#ffffff","xyGraph_bar_barSpacing":0,"graph_labelFontId":"defaultFont","graph_labelOffset":"10","xyGraph_drawMode":"sideBySide","xyGraph_yGranularity":"10","xyGraph_chartHeight":"200","graph_imageHeight":"300","graph_imageWidth":"300","xyGraph_drawLabels":"1","xyGraph_bar_groupSpacing":0,"graph_paletteId":"defaultPalette"}',
|
||||
});
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
$versionTag->commit;
|
||||
|
||||
isa_ok($poll, 'WebGUI::Asset::Wobject::Poll');
|
||||
|
||||
$poll->setVote('daily', 1, '127.0.0.1');
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ plan tests => 4;
|
|||
#----------------------------------------------------------------------------
|
||||
# put your tests here
|
||||
|
||||
my $defaultNode = WebGUI::Asset->getDefault($session);
|
||||
my $defaultNode = WebGUI::Test->asset;
|
||||
|
||||
my $report = $defaultNode->addChild({
|
||||
className => 'WebGUI::Asset::Wobject::SQLReport',
|
||||
|
|
@ -44,10 +44,6 @@ my $report = $defaultNode->addChild({
|
|||
dqQuery1 => 'select * from users',
|
||||
});
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->commit;
|
||||
addToCleanup($versionTag);
|
||||
|
||||
isa_ok($report, 'WebGUI::Asset::Wobject::SQLReport');
|
||||
|
||||
is($report->get('cacheTimeout'), 50, 'cacheTimeout set correctly');
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ $search->update({
|
|||
};
|
||||
|
||||
my $thread = $collab->addChild($props, @addArgs);
|
||||
$thread->setSkipNotification;
|
||||
$versionTag2->commit();
|
||||
addToCleanup($versionTag2);
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ SKIP: {
|
|||
|
||||
skip "Unable to load module $class", $tests unless $loaded;
|
||||
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
my $root = WebGUI::Test->asset;
|
||||
my $shelf = $root->addChild({className => $class});
|
||||
|
||||
#######################################################################
|
||||
|
|
@ -426,7 +426,7 @@ SKIP: {
|
|||
#
|
||||
#######################################################################
|
||||
|
||||
$shelf2 = WebGUI::Asset->getRoot($session)->addChild({className => $class});
|
||||
$shelf2 = WebGUI::Test->asset->addChild({className => $class});
|
||||
|
||||
$pass = 0;
|
||||
eval {
|
||||
|
|
@ -442,11 +442,6 @@ SKIP: {
|
|||
$shelf2->purge;
|
||||
undef $shelf2;
|
||||
|
||||
##Clear out this tag so we can do downstream work.
|
||||
my $tag = WebGUI::VersionTag->getWorking($session);
|
||||
$tag->commit;
|
||||
WebGUI::Test->addToCleanup($tag);
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# Template variables
|
||||
|
|
@ -468,9 +463,6 @@ SKIP: {
|
|||
className => $class,
|
||||
templateId => $testTemplate->getId,
|
||||
});
|
||||
my $tag2 = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($tag2);
|
||||
$tag2->commit;
|
||||
$session->user({userId => 1});
|
||||
$testShelf->prepareView;
|
||||
my $json = $testShelf->view;
|
||||
|
|
@ -483,10 +475,6 @@ SKIP: {
|
|||
groupIdView => $inGroup->getId,
|
||||
title => 'Private Product',
|
||||
});
|
||||
my $tag3 = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($tag3);
|
||||
$tag3->commit;
|
||||
|
||||
$session->user({user => $tommy});
|
||||
$testShelf->prepareView;
|
||||
$json = $testShelf->view;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ my $versionTag;
|
|||
my $creationDateSth = $session->db->prepare('update asset set creationDate=? where assetId=?');
|
||||
my @skipAutoCommit = WebGUI::Test->getAssetSkipCoda;
|
||||
|
||||
my $home = WebGUI::Asset->getDefault($session);
|
||||
my $home = WebGUI::Test->asset;
|
||||
|
||||
$versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
my %tag = ( tagId => $versionTag->getId, status => "pending" );
|
||||
|
|
@ -137,11 +137,11 @@ is($todayFolder->get('styleTemplateId'), $archive->get('styleTemplateId'), '...
|
|||
addToCleanup($arch2);
|
||||
|
||||
is $arch2->get('url'),
|
||||
'home/extension-tester.ext',
|
||||
$home->get('url').'/extension-tester.ext',
|
||||
'ext added';
|
||||
|
||||
is $arch2->getFolderUrl('blah'),
|
||||
'home/extension-tester/blah.ext',
|
||||
$home->get('url').'/extension-tester/blah.ext',
|
||||
'folder url: strip extension from parent and add to child';
|
||||
|
||||
my $folder = $arch2->getFolder($now);
|
||||
|
|
@ -710,10 +710,6 @@ WebGUI::Test->addToCleanup($zzz_child);
|
|||
|
||||
$archive->update({storiesPerPage => 25, storySortOrder => 'Alphabetically' });
|
||||
|
||||
$tag1 = WebGUI::VersionTag->getWorking($session);
|
||||
$tag1->commit;
|
||||
WebGUI::Test->addToCleanup($tag1);
|
||||
|
||||
$templateVars = $archive->viewTemplateVariables();
|
||||
|
||||
cmp_deeply (
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ my $class = 'WebGUI::Asset::Wobject::StoryTopic';
|
|||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
|
||||
my $archive = WebGUI::Asset->getDefault($session)->addChild({className => 'WebGUI::Asset::Wobject::StoryArchive', title => 'My Stories', url => '/home/mystories'});
|
||||
my $archive = WebGUI::Test->asset->addChild({className => 'WebGUI::Asset::Wobject::StoryArchive', title => 'My Stories', url => '/home/mystories'});
|
||||
|
||||
my $now = time();
|
||||
my $nowFolder = $archive->getFolder($now);
|
||||
|
|
@ -72,7 +72,7 @@ STORY: foreach my $name (@characters) {
|
|||
$storyHandler->{bogs}->update({subtitle => 'drinking his food through a straw'});
|
||||
|
||||
my $topicTag = WebGUI::VersionTag->getWorking($session);
|
||||
my $topic = WebGUI::Asset->getDefault($session)->addChild({
|
||||
my $topic = WebGUI::Test->asset->addChild({
|
||||
className => 'WebGUI::Asset::Wobject::StoryTopic',
|
||||
title => 'Popular inmates in Shawshank Prison',
|
||||
keywords => join(',', @inmates),
|
||||
|
|
@ -364,7 +364,7 @@ cmp_deeply(
|
|||
# Regression -- Empty StoryTopics shouldn't blow up
|
||||
################################################################
|
||||
|
||||
my $emptyarchive = WebGUI::Asset->getDefault($session)->addChild({
|
||||
my $emptyarchive = WebGUI::Test->asset->addChild({
|
||||
className => 'WebGUI::Asset::Wobject::StoryTopic',
|
||||
title => 'Why Do Good Things Happen To Bad People',
|
||||
url => '/home/badstories',
|
||||
|
|
|
|||
|
|
@ -25,14 +25,10 @@ my ($survey);
|
|||
|
||||
my $user = WebGUI::User->new( $session, 'new' );
|
||||
WebGUI::Test->addToCleanup($user);
|
||||
my $import_node = WebGUI::Asset->getImportNode($session);
|
||||
my $import_node = WebGUI::Test->asset;
|
||||
|
||||
# Create a Survey
|
||||
$survey = $import_node->addChild( { className => 'WebGUI::Asset::Wobject::Survey', } );
|
||||
my $tag = WebGUI::VersionTag->getWorking($session);
|
||||
$tag->commit;
|
||||
$survey = $survey->cloneFromDb;
|
||||
WebGUI::Test->addToCleanup($survey);
|
||||
isa_ok($survey, 'WebGUI::Asset::Wobject::Survey');
|
||||
|
||||
my $sJSON = $survey->getSurveyJSON;
|
||||
|
|
|
|||
|
|
@ -30,12 +30,9 @@ my %var;
|
|||
## SETUP ##
|
||||
##############################
|
||||
# Do our work in the import node
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $node = WebGUI::Test->asset;
|
||||
|
||||
# Create a version tag to work in
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"SyndicatedContent Test"});
|
||||
addToCleanup($versionTag);
|
||||
my $syndicated_content = $node->addChild({className=>'WebGUI::Asset::Wobject::SyndicatedContent'});
|
||||
|
||||
##############################
|
||||
|
|
|
|||
|
|
@ -32,12 +32,9 @@ my %var;
|
|||
##############################
|
||||
|
||||
# Do our work in the import node
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $node = WebGUI::Test->asset;
|
||||
|
||||
# Create a version tag to work in
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"SyndicatedContent Test"});
|
||||
addToCleanup($versionTag);
|
||||
my $syndicated_content = $node->addChild({className=>'WebGUI::Asset::Wobject::SyndicatedContent'});
|
||||
|
||||
####################################################################
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use Data::Dumper;
|
|||
my $session = WebGUI::Test->session;
|
||||
|
||||
# Do our work in the import node
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $node = WebGUI::Test->asset;
|
||||
|
||||
my $templateId = 'THING_EDIT_TEMPLATE___';
|
||||
my $templateMock = WebGUI::Test::MockAsset->new('WebGUI::Asset::Template');
|
||||
|
|
@ -32,9 +32,6 @@ $templateMock->mock_id($templateId);
|
|||
my $templateVars;
|
||||
$templateMock->mock('process', sub { $templateVars = $_[1]; } );
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Thingy Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $thingy = $node->addChild({className=>'WebGUI::Asset::Wobject::Thingy'});
|
||||
|
||||
# Test for a sane object type
|
||||
|
|
|
|||
|
|
@ -21,11 +21,7 @@ use WebGUI::Asset::Wobject::UserList;
|
|||
my $session = WebGUI::Test->session;
|
||||
|
||||
# Do our work in the import node
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"UserList Test"});
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $node = WebGUI::Test->asset;
|
||||
my $userList = $node->addChild({className=>'WebGUI::Asset::Wobject::UserList'});
|
||||
|
||||
# Test for a sane object type
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use WebGUI::Session;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $import = WebGUI::Asset->getImportNode( $session );
|
||||
my $import = WebGUI::Test->asset;
|
||||
|
||||
my @childCoda = (undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1, } );
|
||||
my @revCoda = (undef, { skipAutoCommitWorkflows => 1, skipNotification => 1, } );
|
||||
|
|
@ -37,13 +37,7 @@ my $wiki
|
|||
title => 'testwiki',
|
||||
}, @childCoda );
|
||||
|
||||
my $wikitag = WebGUI::VersionTag->getWorking( $session );
|
||||
$wikitag->commit;
|
||||
WebGUI::Test->addToCleanup($wikitag);
|
||||
$wiki = $wiki->cloneFromDb;
|
||||
|
||||
my %page_set = ();
|
||||
|
||||
foreach my $keywords (qw/staff inmates criminals/) {
|
||||
$page_set{$keywords} = $wiki->addChild({
|
||||
className => 'WebGUI::Asset::WikiPage',
|
||||
|
|
@ -51,11 +45,6 @@ foreach my $keywords (qw/staff inmates criminals/) {
|
|||
}, @childCoda);
|
||||
}
|
||||
|
||||
my $tag_set1 = WebGUI::VersionTag->getWorking($session);
|
||||
$tag_set1->commit;
|
||||
WebGUI::Test->addToCleanup($tag_set1);
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
|
|
@ -149,10 +138,6 @@ foreach my $title (qw/red andy brooks heywood norton hadley/) {
|
|||
}, @childCoda);
|
||||
}
|
||||
|
||||
my $tag_set2 = WebGUI::VersionTag->getWorking($session);
|
||||
$tag_set2->commit;
|
||||
WebGUI::Test->addToCleanup($tag_set2);
|
||||
|
||||
cmp_deeply(
|
||||
$wiki->getKeywordHierarchy(),
|
||||
[
|
||||
|
|
@ -188,10 +173,6 @@ cmp_deeply(
|
|||
$wiki->setSubKeywords('andy', 'criminals', 'inmates');
|
||||
$wiki->setSubKeywords('brooks', 'criminals');
|
||||
|
||||
my $tag_set3 = WebGUI::VersionTag->getWorking($session);
|
||||
$tag_set3->commit;
|
||||
WebGUI::Test->addToCleanup($tag_set3);
|
||||
|
||||
cmp_deeply(
|
||||
$wiki->getKeywordHierarchy(),
|
||||
[
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use WebGUI::Session;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $import = WebGUI::Asset->getImportNode( $session );
|
||||
my $import = WebGUI::Test->asset;
|
||||
|
||||
my $wiki
|
||||
= $import->addChild( {
|
||||
|
|
@ -42,8 +42,6 @@ my $featuredPage
|
|||
content => 'A how-to book',
|
||||
}, undef, undef, { skipAutoCommitWorkflows => 1 } );
|
||||
|
||||
WebGUI::Test->addToCleanup( WebGUI::VersionTag->getWorking( $session ) );
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use WebGUI::Group;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $import = WebGUI::Asset->getImportNode( $session );
|
||||
my $import = WebGUI::Test->asset;
|
||||
my $wiki
|
||||
= $import->addChild( {
|
||||
className => 'WebGUI::Asset::Wobject::WikiMaster',
|
||||
|
|
@ -30,8 +30,6 @@ my $wiki
|
|||
groupIdView => '7', # Everyone
|
||||
} );
|
||||
|
||||
WebGUI::Test->addToCleanup( WebGUI::VersionTag->getWorking( $session ) );
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
|
|
|
|||
|
|
@ -71,9 +71,6 @@ sub www_dies {
|
|||
|
||||
package main;
|
||||
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
WebGUI::Test->addToCleanup( $tag );
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
|
|
@ -83,7 +80,7 @@ plan tests => 18; # Increment this number for each test you create
|
|||
# Test dispatch
|
||||
|
||||
# Add a TestDispatch asset and test
|
||||
my $td = WebGUI::Asset->getImportNode( $session )->addChild( {
|
||||
my $td = WebGUI::Test->asset->addChild( {
|
||||
url => 'testDispatch',
|
||||
className => 'WebGUI::Asset::TestDispatch',
|
||||
} );
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ use Storable qw/dclone/;
|
|||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $rootAsset = WebGUI::Asset->getRoot($session);
|
||||
my $rootAsset = WebGUI::Test->asset;
|
||||
|
||||
##Test users.
|
||||
##All users in here will be deleted at the end of the test. DO NOT PUT
|
||||
|
|
@ -97,12 +97,8 @@ $properties = {
|
|||
groupIdView => 7,
|
||||
};
|
||||
|
||||
my $versionTag2 = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTag2);
|
||||
|
||||
my $canEditAsset = $rootAsset->addChild($properties, $properties->{id});
|
||||
|
||||
$versionTag2->commit;
|
||||
$properties = {}; ##Clear out the hash so that it doesn't leak later by accident.
|
||||
|
||||
my $canEditMaker = WebGUI::Test::Maker::Permission->new();
|
||||
|
|
@ -113,8 +109,6 @@ $canEditMaker->prepare({
|
|||
'fail' => [1, $testUsers{'regular user'}, ],
|
||||
});
|
||||
|
||||
my $versionTag3 = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTag3);
|
||||
$properties = {
|
||||
# '1234567890123456789012'
|
||||
id => 'canViewAsset0000000010',
|
||||
|
|
@ -129,7 +123,6 @@ $properties = {
|
|||
|
||||
my $canViewAsset = $rootAsset->addChild($properties, $properties->{id});
|
||||
|
||||
$versionTag3->commit;
|
||||
$properties = {}; ##Clear out the hash so that it doesn't leak later by accident.
|
||||
|
||||
my $canViewMaker = WebGUI::Test::Maker::Permission->new();
|
||||
|
|
@ -161,7 +154,7 @@ plan tests => $canAddMaker->plan
|
|||
|
||||
$session->config->set('assets/WebGUI::Asset/addGroup', $testGroups{'canAdd asset'}->getId );
|
||||
|
||||
$session->asset(WebGUI::Asset->getDefault($session));
|
||||
$session->asset(WebGUI::Test->asset);
|
||||
$canAddMaker->run;
|
||||
|
||||
#Without proper group setup, Turn On Admin is excluded from adding assets via assetAddPrivilege
|
||||
|
|
|
|||
|
|
@ -27,16 +27,12 @@ use WebGUI::Test::Mechanize;
|
|||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $asset = WebGUI::Asset->getImportNode( $session )->addChild( {
|
||||
my $asset = WebGUI::Test->asset->addChild( {
|
||||
className => 'WebGUI::Asset::Snippet',
|
||||
url => 'example',
|
||||
groupIdEdit => 3, # Admins
|
||||
} );
|
||||
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
$tag->commit;
|
||||
addToCleanup( $tag );
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Check permissions
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ my $session = WebGUI::Test->session;
|
|||
# put your tests here
|
||||
|
||||
my $output;
|
||||
my $home = WebGUI::Asset->getDefault($session);
|
||||
my $home = WebGUI::Test->asset;
|
||||
|
||||
my $editor = WebGUI::User->create($session);
|
||||
$editor->addToGroups([4]);
|
||||
|
|
@ -42,9 +42,6 @@ my $newPage = $home->addChild({
|
|||
groupIdEdit => '4',
|
||||
ownerUserId => '3',
|
||||
}, undef, WebGUI::Test->webguiBirthday, { skipAutoCommitWorkflows => 1, });
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->commit;
|
||||
addToCleanup($versionTag);
|
||||
|
||||
$newPage = WebGUI::Asset->newById($session, $newPage->assetId);
|
||||
|
||||
|
|
@ -68,9 +65,6 @@ cmp_deeply(
|
|||
'... locks the asset'
|
||||
);
|
||||
|
||||
my $versionTag2 = WebGUI::VersionTag->getWorking($session);
|
||||
addToCleanup($versionTag2);
|
||||
|
||||
$newPage = WebGUI::Asset->newById($session, $newPage->assetId);
|
||||
ok $newPage->isLocked, 'Asset is locked, and ready for next test';
|
||||
is $newPage->getRevisionCount, 2, 'new revision added';
|
||||
|
|
|
|||
|
|
@ -29,9 +29,7 @@ use WebGUI::Test::Mechanize;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $node = WebGUI::Asset->getImportNode( $session );
|
||||
my $versionTag = WebGUI::VersionTag->getWorking( $session );
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my $node = WebGUI::Test->asset;
|
||||
|
||||
# Override some settings to make things easier to test
|
||||
# userFunctionStyleId
|
||||
|
|
@ -66,9 +64,7 @@ my $asset
|
|||
groupIdEdit => 3, # Admins
|
||||
styleTemplateId => 'PBtmpl0000000000000132',
|
||||
});
|
||||
$versionTag->commit;
|
||||
my $assetUrl = $baseUrl . $asset->get('url');
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ sub www_edit { return "you'll never see me!" }
|
|||
package main;
|
||||
|
||||
my $td
|
||||
= WebGUI::Asset->getImportNode( $session )->addChild( {
|
||||
= WebGUI::Test->asset->addChild( {
|
||||
title => "one",
|
||||
className => 'WebGUI::Asset::TestDispatch',
|
||||
url => 'testdispatch',
|
||||
|
|
@ -80,14 +80,12 @@ my $td
|
|||
my $utf8_url = "Viel-spa\x{00DF}";
|
||||
utf8::upgrade $utf8_url;
|
||||
my $utf8
|
||||
= WebGUI::Asset->getImportNode( $session )->addChild( {
|
||||
= WebGUI::Test->asset->addChild( {
|
||||
title => "utf8",
|
||||
className => 'WebGUI::Asset::TestDispatch',
|
||||
url => $utf8_url,
|
||||
} );
|
||||
|
||||
WebGUI::Test->addToCleanup( WebGUI::VersionTag->getWorking( $session ) );
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# test getUrlPermutation( url ) method
|
||||
|
||||
|
|
@ -159,12 +157,11 @@ is $output, "bar", "special /foo handler";
|
|||
|
||||
# Add an asset that clobbers the TestDispatch's /foo
|
||||
my $clobberingTime
|
||||
= WebGUI::Asset->getImportNode( $session )->addChild( {
|
||||
= WebGUI::Test->asset->addChild( {
|
||||
title => "two",
|
||||
className => 'WebGUI::Asset::TestDispatch',
|
||||
url => $td->get('url') . '/foo',
|
||||
} );
|
||||
WebGUI::Test->addToCleanup($clobberingTime);
|
||||
|
||||
is(
|
||||
WebGUI::Content::Asset::dispatch( $session, "testdispatch/foo" ),
|
||||
|
|
@ -177,7 +174,7 @@ $clobberingTime->purge;
|
|||
|
||||
# Add an asset that declines everything instead
|
||||
my $declined
|
||||
= WebGUI::Asset->getImportNode( $session )->addChild( {
|
||||
= WebGUI::Test->asset->addChild( {
|
||||
title => "three",
|
||||
className => 'WebGUI::Asset::TestDecline',
|
||||
url => $td->get('url') . '/foo',
|
||||
|
|
@ -209,14 +206,10 @@ $session->setting->set('defaultPage', $originalDefaultPage);
|
|||
#----------------------------------------------------------------------------
|
||||
# 304 Content Not Modified response
|
||||
|
||||
my $newAsset = WebGUI::Asset->getImportNode( $session )->addChild( {
|
||||
my $newAsset = WebGUI::Test->asset->addChild( {
|
||||
className => 'WebGUI::Asset::Wobject::Article',
|
||||
} );
|
||||
|
||||
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||
$tag->commit;
|
||||
WebGUI::Test->addToCleanup( $tag );
|
||||
|
||||
my $http_request = HTTP::Request::Common::GET('http://'.$session->config->get('sitename')->[0]);
|
||||
$http_request->header('If-Modified-Since' => $session->datetime->epochToHttp(time + 20)); # 20 seconds into the future!
|
||||
my $notModifiedSession = WebGUI::Test->newSession( undef, $http_request);
|
||||
|
|
@ -244,14 +237,13 @@ is $output, undef, 'getting a URL which does not exist returns undef';
|
|||
is $session->asset, undef, '... session asset is not set';
|
||||
|
||||
use WebGUI::Asset::RssAspectDummy;
|
||||
my $dummy = WebGUI::Asset->getImportNode($session)->addChild({
|
||||
my $dummy = WebGUI::Test->asset->addChild({
|
||||
className => 'WebGUI::Asset::RssAspectDummy',
|
||||
url => '/home/shawshank',
|
||||
title => 'Dummy Title',
|
||||
synopsis => 'Dummy Synopsis',
|
||||
description => 'Dummy Description',
|
||||
});
|
||||
WebGUI::Test->addToCleanup($dummy);
|
||||
$output = WebGUI::Content::Asset::dispatch( $session, '/home/shawshank/no-child-here' );
|
||||
is $output, undef, 'RSS Aspect propagates the fragment';
|
||||
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ cmp_ok($bundle->get('lastModified'), '>=', $startTime, '... updates lastModified
|
|||
#
|
||||
###################################################################
|
||||
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
my $root = WebGUI::Test->asset;
|
||||
|
||||
my $snippet = $root->addChild({
|
||||
className => 'WebGUI::Asset::Snippet',
|
||||
|
|
@ -276,15 +276,6 @@ WebGUI::Test->addToCleanup($storage);
|
|||
$storage->addFileFromScalar('addendum', 'Red was too');
|
||||
$storage->addFileFromFilesystem(WebGUI::Test->getTestCollateralPath('ShawshankRedemptionMoviePoster.jpg'));
|
||||
|
||||
my $snippetTag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($snippetTag);
|
||||
$snippetTag->commit;
|
||||
|
||||
|
||||
foreach my $asset ($snippet, $fileAsset) {
|
||||
$asset = $asset->cloneFromDb;
|
||||
}
|
||||
|
||||
my $guts;
|
||||
$guts = $bundle->fetchAsset(URI->new('asset://filePumpSnippet'));
|
||||
cmp_deeply(
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ WebGUI::Test->addToCleanup($settingGroup);
|
|||
my $activityGroup = WebGUI::Group->new($session, 'new');
|
||||
WebGUI::Test->addToCleanup($activityGroup);
|
||||
|
||||
my $home = WebGUI::Asset->getDefault($session);
|
||||
my $home = WebGUI::Test->asset;
|
||||
|
||||
my $snippet1 = $home->addChild({
|
||||
className => 'WebGUI::Asset::Snippet',
|
||||
|
|
@ -174,4 +174,3 @@ $activityGroup->delete;
|
|||
my $userActivity2 = WebGUI::Workflow::Activity->new($session, $userActivity->getId);
|
||||
is ($userActivity2->get('groupId'), 3, 'group in Workflow Activity set to Admin');
|
||||
|
||||
WebGUI::Test->addToCleanup(WebGUI::VersionTag->getWorking($session));
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use Data::Dumper;
|
|||
my $session = WebGUI::Test->session;
|
||||
|
||||
# put your tests here
|
||||
my $home = WebGUI::Asset->getDefault($session);
|
||||
my $home = WebGUI::Test->asset;
|
||||
|
||||
isa_ok($home, "WebGUI::Asset");
|
||||
my $keyword = WebGUI::Keyword->new($session);
|
||||
|
|
@ -66,10 +66,6 @@ my $snippet = $home->addChild({
|
|||
keywords => 'webgui',
|
||||
});
|
||||
|
||||
my $tag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($tag);
|
||||
$tag->commit;
|
||||
|
||||
my $assetIds = $keyword->getMatchingAssets({ keyword => 'webgui', });
|
||||
|
||||
cmp_deeply(
|
||||
|
|
@ -81,7 +77,6 @@ cmp_deeply(
|
|||
# sorted by title, alphabetically
|
||||
|
||||
my $aa_story = $home->addChild({ className => 'WebGUI::Asset::Snippet', title => "aaaa", keywords => 'webgui' });
|
||||
WebGUI::Test->addToCleanup($aa_story);
|
||||
|
||||
$assetIds = $keyword->getMatchingAssets({ keyword => 'webgui', sortOrder => 'Alphabetically', });
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ my $session = WebGUI::Test->session;
|
|||
|
||||
my $template = addTemplate();
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
my $homeAsset = WebGUI::Test->asset;
|
||||
$session->asset($homeAsset);
|
||||
|
||||
my $i18n = WebGUI::International->new($session,'Macro_AdminToggle');
|
||||
|
|
@ -94,9 +94,7 @@ TODO: {
|
|||
|
||||
sub addTemplate {
|
||||
$session->user({userId=>3});
|
||||
my $importNode = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"AdminToggle test"});
|
||||
my $importNode = WebGUI::Test->asset;
|
||||
my $properties = {
|
||||
title => 'AdminToggle test template',
|
||||
className => 'WebGUI::Asset::Template',
|
||||
|
|
@ -107,8 +105,6 @@ sub addTemplate {
|
|||
usePacked => 0,
|
||||
};
|
||||
my $template = $importNode->addChild($properties, $properties->{id});
|
||||
$versionTag->commit;
|
||||
addToCleanup($versionTag);
|
||||
return $template;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ my $session = WebGUI::Test->session;
|
|||
|
||||
use Test::More; # increment this value for each test you create
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
my $homeAsset = WebGUI::Test->asset;
|
||||
my ($asset, $group, @users) = setupTest($session, $homeAsset);
|
||||
|
||||
my @testSets = (
|
||||
|
|
@ -84,8 +84,6 @@ sub setupTest {
|
|||
my $cm = WebGUI::Group->find($session, "Content Managers");
|
||||
$cm->addGroups([$editGroup->getId]);
|
||||
##Create an asset with specific editing privileges
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"CanEditText test"});
|
||||
my $properties = {
|
||||
title => 'CanEditText test template',
|
||||
className => 'WebGUI::Asset::Wobject::Article',
|
||||
|
|
@ -94,13 +92,12 @@ sub setupTest {
|
|||
id => 'CanEditTextTestAsset01',
|
||||
groupIdEdit => $editGroup->getId(),
|
||||
};
|
||||
my $asset = $defaultNode->addChild($properties, $properties->{id});
|
||||
$versionTag->commit;
|
||||
my $asset = WebGUI::Test->asset->addChild($properties, $properties->{id});
|
||||
my @users = map { WebGUI::User->new($session, "new") } 0..2;
|
||||
##User 1 is a content manager
|
||||
$users[1]->addToGroups([$cm->getId]);
|
||||
##User 2 is a member of a content manager sub-group
|
||||
$users[2]->addToGroups([$editGroup->getId]);
|
||||
addToCleanup($versionTag, $editGroup, @users);
|
||||
addToCleanup($editGroup, @users);
|
||||
return ($asset, $editGroup, @users);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ use Test::More; # increment this value for each test you create
|
|||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
my ($versionTag, $asset, @users) = setupTest($session, $homeAsset);
|
||||
my $homeAsset = WebGUI::Test->asset;
|
||||
my ($asset, @users) = setupTest($session, $homeAsset);
|
||||
|
||||
my $i18n = WebGUI::International->new($session,'Macro_EditableToggle');
|
||||
|
||||
|
|
@ -247,8 +247,6 @@ sub setupTest {
|
|||
my $editGroup = WebGUI::Group->new($session, "new");
|
||||
my $tao = WebGUI::Group->find($session, "Turn Admin On");
|
||||
##Create an asset with specific editing privileges
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"EditableToggle test"});
|
||||
my $properties = {
|
||||
title => 'EditableToggle test template',
|
||||
className => 'WebGUI::Asset::Template',
|
||||
|
|
@ -260,13 +258,12 @@ sub setupTest {
|
|||
id => 'EditableToggleTemplate',
|
||||
usePacked => 1,
|
||||
};
|
||||
my $asset = $defaultNode->addChild($properties, $properties->{id});
|
||||
$versionTag->commit;
|
||||
my $asset = WebGUI::Test->asset->addChild($properties, $properties->{id});
|
||||
my @users = map { WebGUI::User->new($session, "new") } 0..2;
|
||||
##User 1 is an editor
|
||||
$users[1]->addToGroups([$editGroup->getId]);
|
||||
##User 2 is an editor AND can turn on Admin
|
||||
$users[2]->addToGroups([$editGroup->getId, $tao->getId]);
|
||||
addToCleanup($versionTag, $editGroup, @users);
|
||||
return ($versionTag, $asset, @users);
|
||||
addToCleanup($editGroup, @users);
|
||||
return ($asset, @users);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ plan tests => 11;
|
|||
|
||||
my $bundle = WebGUI::FilePump::Bundle->new($session, { bundleName => 'test bundle'});
|
||||
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
my $root = WebGUI::Test->asset;
|
||||
|
||||
my $snippet = $root->addChild({
|
||||
className => 'WebGUI::Asset::Snippet',
|
||||
|
|
@ -51,10 +51,6 @@ my $fileAsset = $root->addChild({
|
|||
$fileAsset->getStorageLocation->addFileFromScalar('pumpfile.css', qq| body {\npadding: 0px;}\n\n|);
|
||||
is($fileAsset->getStorageLocation->getFileContentsAsScalar($fileAsset->get('filename')), qq| body {\npadding: 0px;}\n\n|, 'Sanity check - got back expected file contents');
|
||||
|
||||
my $snippetTag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($snippetTag);
|
||||
$snippetTag->commit;
|
||||
|
||||
ok($bundle->addFile('JS', 'asset://filePumpSnippet'), 'Added filePumpSnippet');
|
||||
ok($bundle->addFile('CSS', 'asset://filePumpFileAsset'), 'Added filePumpAsset');
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ $numTests += 1; #non-existant URL
|
|||
|
||||
plan tests => $numTests;
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
my $homeAsset = WebGUI::Test->asset;
|
||||
|
||||
my @testSets = setupTest($session, $homeAsset, @testSets);
|
||||
|
||||
|
|
@ -107,8 +107,6 @@ is($output, $i18n->get('invalid url'), "Non-existant url returns error message")
|
|||
|
||||
sub setupTest {
|
||||
my ($session, $homeAsset, @testSets) = @_;
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"FileUrl macro test"});
|
||||
my $testNum = 0;
|
||||
foreach my $testSet (@testSets) {
|
||||
|
||||
|
|
@ -133,7 +131,5 @@ sub setupTest {
|
|||
$testSet->{asset} = $asset;
|
||||
++$testNum;
|
||||
}
|
||||
$versionTag->commit;
|
||||
addToCleanup($versionTag);
|
||||
return @testSets;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use JSON qw/from_json/;
|
|||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
my $homeAsset = WebGUI::Test->asset;
|
||||
my ($template, $groups, $users) = setupTest($session, $homeAsset);
|
||||
|
||||
my @testSets = (
|
||||
|
|
@ -153,8 +153,6 @@ sub setupTest {
|
|||
$users[1]->addToGroups([$groups[1]->getId]);
|
||||
addToCleanup(@users);
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"GroupAdd test"});
|
||||
my $properties = {
|
||||
title => 'GroupAdd test template',
|
||||
className => 'WebGUI::Asset::Template',
|
||||
|
|
@ -166,8 +164,6 @@ sub setupTest {
|
|||
usePacked => 1,
|
||||
};
|
||||
my $asset = $defaultNode->addChild($properties, $properties->{id});
|
||||
$versionTag->commit;
|
||||
addToCleanup($versionTag);
|
||||
|
||||
return $asset, \@groups, \@users;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use HTML::TokeParser;
|
|||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
my $homeAsset = WebGUI::Test->asset;
|
||||
my ($template, $groups, $users) = setupTest($session, $homeAsset);
|
||||
|
||||
my @testSets = (
|
||||
|
|
@ -152,8 +152,6 @@ sub setupTest {
|
|||
$users[1]->addToGroups([$groups[1]->getId]);
|
||||
addToCleanup(@users);
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"GroupDelete test"});
|
||||
my $properties = {
|
||||
title => 'GroupDelete test template',
|
||||
className => 'WebGUI::Asset::Template',
|
||||
|
|
@ -165,8 +163,6 @@ sub setupTest {
|
|||
id => 'GroupDelete001Template',
|
||||
};
|
||||
my $asset = $defaultNode->addChild($properties, $properties->{id});
|
||||
$versionTag->commit;
|
||||
addToCleanup($versionTag);
|
||||
|
||||
return $asset, \@groups, \@users;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ use Test::More; # increment this value for each test you create
|
|||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my ($versionTag, $template) = addTemplate();
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
my ($template) = addTemplate();
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
my $homeAsset = WebGUI::Test->asset;
|
||||
$session->setting->set( 'defaultPage', $homeAsset->getId );
|
||||
|
||||
my $i18n = WebGUI::International->new($session,'Macro_H_homeLink');
|
||||
|
||||
|
|
@ -89,9 +89,7 @@ foreach my $testSet (@testSets) {
|
|||
|
||||
sub addTemplate {
|
||||
$session->user({userId=>3});
|
||||
my $importNode = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"H_homeLink test"});
|
||||
my $importNode = WebGUI::Test->asset;
|
||||
my $properties = {
|
||||
title => 'H_homeLink test template',
|
||||
className => 'WebGUI::Asset::Template',
|
||||
|
|
@ -102,8 +100,7 @@ sub addTemplate {
|
|||
usePacked => 1,
|
||||
};
|
||||
my $template = $importNode->addChild($properties, $properties->{id});
|
||||
$versionTag->commit;
|
||||
return ($versionTag, $template);
|
||||
return ($template);
|
||||
}
|
||||
|
||||
sub simpleHTMLParser {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use Test::More; # increment this value for each test you create
|
|||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
my $homeAsset = WebGUI::Test->asset;
|
||||
$session->asset($homeAsset);
|
||||
my $template = setupTest($session, $homeAsset);
|
||||
$session->user({userId=>1});
|
||||
|
|
@ -197,8 +197,6 @@ sub setupTest {
|
|||
my ($session, $defaultNode) = @_;
|
||||
$session->user({userId=>3});
|
||||
##Create an asset with specific editing privileges
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"L_loginBox test"});
|
||||
my $properties = {
|
||||
title => 'L_loginBox test template',
|
||||
className => 'WebGUI::Asset::Template',
|
||||
|
|
@ -219,7 +217,5 @@ sub setupTest {
|
|||
account.create.label form.footer form.returnUrl/;
|
||||
#$properties->{template} .= "\n";
|
||||
my $template = $defaultNode->addChild($properties, $properties->{id});
|
||||
$versionTag->commit;
|
||||
addToCleanup($versionTag);
|
||||
return $template;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use Test::More; # increment this value for each test you create
|
|||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
my $homeAsset = WebGUI::Test->asset;
|
||||
|
||||
my ($time) = $session->dbSlave->quickArray("SELECT max(revisionDate) FROM assetData where assetId=?",[$homeAsset->getId]);
|
||||
|
||||
|
|
@ -49,9 +49,6 @@ $numTests += 2; #For the use_ok, default asset, and revisionDate=0
|
|||
|
||||
plan tests => $numTests;
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
addToCleanup($versionTag);
|
||||
|
||||
my $output = WebGUI::Macro::LastModified::process($session);
|
||||
is($output, '', "Macro returns '' if no asset is defined");
|
||||
|
||||
|
|
@ -63,9 +60,7 @@ foreach my $testSet (@testSets) {
|
|||
is($output, $testSet->{output}, $testSet->{comment});
|
||||
}
|
||||
|
||||
$versionTag->set({name=>"Adding assets for LastModified macro tests"});
|
||||
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
my $root = WebGUI::Test->asset;
|
||||
my %properties_A = (
|
||||
className => 'WebGUI::Asset',
|
||||
title => 'Asset A',
|
||||
|
|
@ -78,7 +73,6 @@ my %properties_A = (
|
|||
);
|
||||
|
||||
my $assetA = $root->addChild(\%properties_A, $properties_A{id}, 0e0);
|
||||
$versionTag->commit;
|
||||
|
||||
##Save the original revisionDate and then rewrite it in the db to be 0
|
||||
my $revDate = $session->db->quickArray('select max(revisionDate) from assetData where assetId=?', [$assetA->getId]);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use Test::More; # increment this value for each test you create
|
|||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
my $homeAsset = WebGUI::Test->asset;
|
||||
$session->asset($homeAsset);
|
||||
my $template = setupTest($session, $homeAsset);
|
||||
|
||||
|
|
@ -179,8 +179,6 @@ sub setupTest {
|
|||
$session->user({userId=>3});
|
||||
my $tao = WebGUI::Group->find($session, "Turn Admin On");
|
||||
##Create an asset with specific editing privileges
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"LoginToggle test"});
|
||||
my $properties = {
|
||||
title => 'LoginToggle test template',
|
||||
className => 'WebGUI::Asset::Template',
|
||||
|
|
@ -193,7 +191,5 @@ sub setupTest {
|
|||
id => 'LoginToggleTemplateA01',
|
||||
};
|
||||
my $template = $defaultNode->addChild($properties, $properties->{id});
|
||||
$versionTag->commit;
|
||||
addToCleanup($versionTag);
|
||||
return ($template);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ $numTests += 1; #For macro call with undefined session asset
|
|||
|
||||
plan tests => $numTests;
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
my $homeAsset = WebGUI::Test->asset;
|
||||
|
||||
@testSets = setupTest($session, $homeAsset, @testSets);
|
||||
|
||||
|
|
@ -72,14 +72,10 @@ foreach my $testSet (@testSets) {
|
|||
|
||||
sub setupTest {
|
||||
my ($session, $homeAsset, @testSets) = @_;
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Page macro test"});
|
||||
foreach my $testSet (@testSets) {
|
||||
my %properties = %{ $testSet };
|
||||
my $asset = $homeAsset->addChild(\%properties, $properties{assetId});
|
||||
$testSet->{asset} = $asset;
|
||||
}
|
||||
$versionTag->commit;
|
||||
addToCleanup($versionTag);
|
||||
return @testSets;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,7 @@ my $numTests = 7;
|
|||
|
||||
plan tests => $numTests;
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"PageTitle macro test"});
|
||||
my $homeAsset = WebGUI::Test->asset;
|
||||
|
||||
# Create a new snippet and set it's title then check it against the macros output
|
||||
my $snippetTitle = "Roy's Incredible Snippet of Mystery and Intrique";
|
||||
|
|
@ -39,9 +36,6 @@ my $snippet = $homeAsset->addChild({
|
|||
groupIdEdit=>3,
|
||||
});
|
||||
|
||||
$versionTag->commit;
|
||||
addToCleanup($versionTag);
|
||||
|
||||
is(
|
||||
WebGUI::Macro::PageTitle::process($session),
|
||||
undef,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ my $session = WebGUI::Test->session;
|
|||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Adding assets for RootTitle tests"});
|
||||
my %tag = ( tagId => $versionTag->getId, status => "pending" );
|
||||
addToCleanup($versionTag);
|
||||
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
|
|
@ -41,6 +42,7 @@ my %properties_A = (
|
|||
ownerUserId => 3,
|
||||
groupIdView => 7,
|
||||
groupIdEdit => 3,
|
||||
%tag,
|
||||
id => 'RootA-----------------',
|
||||
# '1234567890123456789012'
|
||||
);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue