diff --git a/lib/WebGUI/Admin.pm b/lib/WebGUI/Admin.pm
index 97236bc7c..638df4e97 100644
--- a/lib/WebGUI/Admin.pm
+++ b/lib/WebGUI/Admin.pm
@@ -661,8 +661,8 @@ sub www_processAssetHelper {
my $class = $asset->getHelpers->{ $helperId }->{ className };
WebGUI::Pluggable::load( $class );
- my $helper = $class->new( id => $helperId, session => $self->session );
- return JSON->new->encode( $helper->process( $asset ) );
+ my $helper = $class->new( id => $helperId, session => $self->session, asset => $asset );
+ return JSON->new->encode( $helper->process );
}
#----------------------------------------------------------------------
@@ -968,17 +968,19 @@ __DATA__
diff --git a/lib/WebGUI/AssetHelper.pm b/lib/WebGUI/AssetHelper.pm
index 0d6aba8ad..bae7af58e 100644
--- a/lib/WebGUI/AssetHelper.pm
+++ b/lib/WebGUI/AssetHelper.pm
@@ -56,6 +56,12 @@ has 'id' => (
isa => 'Str',
);
+has 'asset' => (
+ is => 'ro',
+ required => 1,
+ isa => 'WebGUI::Asset',
+);
+
=head1 METHODS
These methods are available from this class:
@@ -64,6 +70,47 @@ These methods are available from this class:
#-------------------------------------------------------------------
+=head2 getForm ( $method )
+
+Get a WebGUI::FormBuilder that submits to the given www_ $method.
+
+=cut
+
+sub getForm {
+ my ( $self, $method ) = @_;
+
+ my $f = WebGUI::FormBuilder->new( $self->session, action => $self->session->url->page );
+ $f->addField( 'hidden', name => 'op', value => 'assetHelper' );
+ $f->addField( 'hidden', name => 'helperId', value => $self->id );
+ $f->addField( 'hidden', name => 'method', value => $method );
+ $f->addField( 'hidden', name => 'assetId', value => $self->asset->assetId );
+
+ return $f;
+}
+
+#-------------------------------------------------------------------
+
+=head2 getUrl ( $method, $pairs )
+
+Get a URL to call the www_ method of this Asset Helper. $method is the name
+of the method, without the www_. $pairs is a string of name=value; pairs to
+add to the URL.
+
+=cut
+
+sub getUrl {
+ my ( $self, $method, $pairs ) = @_;
+ $method ||= 'view';
+ $pairs ||= '';
+
+ return $self->asset->getUrl(
+ 'op=assetHelper;assetId=' . $self->asset->assetId . ';helperId=' . $self->id
+ . ';method=' . $method . ';' . $pairs
+ );
+}
+
+#-------------------------------------------------------------------
+
=head2 process ( $asset )
Process is the default method called by the Admin Console.
diff --git a/lib/WebGUI/AssetHelper/ChangeUrl.pm b/lib/WebGUI/AssetHelper/ChangeUrl.pm
index bbc0be014..480b950a4 100644
--- a/lib/WebGUI/AssetHelper/ChangeUrl.pm
+++ b/lib/WebGUI/AssetHelper/ChangeUrl.pm
@@ -34,15 +34,16 @@ These methods are available from this class:
#-------------------------------------------------------------------
-=head2 process ( $asset )
+=head2 process ( )
Opens a new tab for displaying the form to change the Asset's URL.
=cut
sub process {
- my ($self, $asset) = @_;
- my $session = $asset->session;
+ my ($self) = @_;
+ my $asset = $self->asset;
+ my $session = $self->session;
my $i18n = WebGUI::International->new($session, "Asset");
if (! $asset->canEdit) {
return {
@@ -51,7 +52,7 @@ sub process {
}
return {
- openDialog => $asset->getUrl('op=assetHelper;helperId=' . $self->id . ';method=changeUrl;assetId=' . $asset->getId ),
+ openDialog => $self->getUrl( 'changeUrl' ),
};
}
@@ -64,19 +65,16 @@ Displays a form to change the URL for this asset.
=cut
sub www_changeUrl {
- my ($self, $asset) = @_;
- my $session = $asset->session;
+ my ($self) = @_;
+ my $asset = $self->asset;
+ my $session = $self->session;
my $i18n = WebGUI::International->new($session, "Asset");
if (! $asset->canEdit) {
return {
error => $i18n->get('38', 'WebGUI'),
}
}
- my $f = WebGUI::FormBuilder->new($session, method => 'POST', action => $asset->getUrl );
- $f->addField( "hidden", name => 'op', value => 'assetHelper' );
- $f->addField( "hidden", name => 'helperId', value => $self->id );
- $f->addField( "hidden", name => "method", value=>"changeUrlSave" );
- $f->addField( "hidden", name => 'assetId', value => $asset->getId );
+ my $f = $self->getForm( 'changeUrlSave' );
$f->addField( "text",
name => "url",
value => $asset->get('url'),
@@ -103,8 +101,9 @@ This actually does the change url of the www_changeUrl() function.
=cut
sub www_changeUrlSave {
- my ($self, $asset) = @_;
- my $session = $asset->session;
+ my ($self) = @_;
+ my $asset = $self->asset;
+ my $session = $self->session;
my $i18n = WebGUI::International->new($session, "Asset");
if (! $asset->canEdit) {
return {
diff --git a/lib/WebGUI/AssetHelper/Copy.pm b/lib/WebGUI/AssetHelper/Copy.pm
index 55af61e61..8d8bd7736 100644
--- a/lib/WebGUI/AssetHelper/Copy.pm
+++ b/lib/WebGUI/AssetHelper/Copy.pm
@@ -33,14 +33,15 @@ These methods are available from this class:
#-------------------------------------------------------------------
-=head2 process ( $asset )
+=head2 process ( )
Fork the copy operation
=cut
sub process {
- my ($self, $asset) = @_;
+ my ($self) = @_;
+ my $asset = $self->asset;
my $session = $self->session;
# Should we autocommit?
diff --git a/lib/WebGUI/AssetHelper/CopyBranch.pm b/lib/WebGUI/AssetHelper/CopyBranch.pm
index e9dd7e896..e8ceea32c 100644
--- a/lib/WebGUI/AssetHelper/CopyBranch.pm
+++ b/lib/WebGUI/AssetHelper/CopyBranch.pm
@@ -3,6 +3,7 @@ package WebGUI::AssetHelper::CopyBranch;
use strict;
use Class::C3;
use base qw/WebGUI::AssetHelper::Copy/;
+use Scalar::Util qw{ blessed };
=head1 LEGAL
@@ -32,69 +33,106 @@ These methods are available from this class:
#-------------------------------------------------------------------
-=head2 process ( $asset )
+=head2 process ()
Open a progress dialog for the copy operation
=cut
sub process {
- my ($self, $asset) = @_;
+ my ($self) = @_;
return {
- openDialog => '?op=assetHelper;helperId=' . $self->id . ';method=getWith;assetId=' . $asset->getId
+ openDialog => $self->getUrl( 'getWith' ),
};
}
#----------------------------------------------------------------------------
-=head2 www_getWith ( $asset )
+=head2 www_getWith ()
Get the "with" configuration. "Descendants" or "Children".
=cut
sub www_getWith {
- my ( $self, $asset ) = @_;
- my $session = $asset->session;
+ my ( $self ) = @_;
+ my $asset = $self->asset;
+ my $session = $self->session;
my $i18n = WebGUI::International->new($session, 'Asset');
- return ''
- ;
+ my $f = $self->getForm( 'copy' );
+ $f->addField( 'submit', name => 'with', value => 'Children' );
+ $f->addField( 'submit', name => 'with', value => 'Descendants' );
+ return $f->toHtml;
}
#----------------------------------------------------------------------------
-=head2 www_copy ( $asset )
+=head2 www_copy ()
-Perform the copy operation, showing the progress.
+Perform the copy operation in a fork
=cut
sub www_copy {
- my ($self, $asset) = @_;
- my $session = $asset->session;
+ my ($self) = @_;
+ my $asset = $self->asset;
+ my $session = $self->session;
- $asset->forkWithStatusPage({
- plugin => 'ProgressTree',
- title => 'Copy Assets',
- method => 'copyInFork',
- dialog => 1,
- message => 'Your assets are now copied!',
- args => {
- childrenOnly => $session->form->get('with') eq 'children',
- assetId => $asset->getId,
- }
- }
+ my $childrenOnly = 1 if lc $session->form->get('with') eq 'children';
+
+ # Should we autocommit?
+ my $commit = $session->setting->get('versionTagMode') eq 'autoCommit';
+
+ # Fork the copy. Forking makes sure it won't get interrupted
+ my $fork = WebGUI::Fork->start(
+ $session, blessed( $self ), 'copyBranch', { childrenOnly => $childrenOnly, assetId => $asset->getId, commit => $commit },
);
+
+ return {
+ forkId => $fork->getId,
+ };
+}
+
+#-------------------------------------------------------------------
+
+=head2 copyBranch ( $process, $args )
+
+Perform the copy stuff in a forked process
+
+=cut
+
+sub copyBranch {
+ my ($process, $args) = @_;
+ my $session = $process->session;
+ my $asset = WebGUI::Asset->newById($session, $args->{assetId});
+
+ # Get the assets we need to duplicate
+ my $assetIds = [];
+ if ( $args->{childrenOnly} ) {
+ $assetIds = $asset->getLineage(['children']);
+ }
+ else {
+ $assetIds = $asset->getLineage(['descendants']);
+ }
+
+ my $tree = WebGUI::ProgressTree->new($session, $assetIds );
+ $process->update(sub { $tree->json });
+ my $newAsset = $asset->duplicateBranch( $args->{childrenOnly} ? 1 : 0, 'clipboard' );
+
+ # If we aren't committing, add to a tag
+ if ( !$args->{commit} ) {
+ $newAsset->update({
+ status => "pending",
+ tagId => WebGUI::VersionTag->getWorking( $session )->getId,
+ });
+ }
+ $newAsset->update({ title => $newAsset->getTitle . ' (copy)'});
+
+ $tree->success($asset->getId);
+ $process->update(sub { $tree->json });
}
1;
diff --git a/lib/WebGUI/AssetHelper/CreateShortcut.pm b/lib/WebGUI/AssetHelper/CreateShortcut.pm
index 756e7d8d1..bcf4f4208 100644
--- a/lib/WebGUI/AssetHelper/CreateShortcut.pm
+++ b/lib/WebGUI/AssetHelper/CreateShortcut.pm
@@ -32,15 +32,16 @@ These methods are available from this class:
#-------------------------------------------------------------------
-=head2 process ( $asset )
+=head2 process ( )
Create a shortcut to the asset on the clipboard.
=cut
sub process {
- my ($self, $asset) = @_;
- my $session = $asset->session;
+ my ($self) = @_;
+ my $session = $self->session;
+ my $asset = $self->asset;
my $i18n = WebGUI::International->new( $session, 'WebGUI' );
return { error => $i18n->get('39') } if !$asset->canView;
diff --git a/lib/WebGUI/AssetHelper/Cut.pm b/lib/WebGUI/AssetHelper/Cut.pm
index cbbf8ad5a..c4c7ebd8b 100644
--- a/lib/WebGUI/AssetHelper/Cut.pm
+++ b/lib/WebGUI/AssetHelper/Cut.pm
@@ -34,7 +34,7 @@ These methods are available from this class:
#-------------------------------------------------------------------
-=head2 process ( $asset )
+=head2 process ()
Cuts the asset to the clipboard. If the user cannot edit the asset, or the asset is a
system asset, it returns an error message.
@@ -42,8 +42,9 @@ system asset, it returns an error message.
=cut
sub process {
- my ($self, $asset) = @_;
- my $session = $asset->session;
+ my ($self) = @_;
+ my $asset = $self->asset;
+ my $session = $self->session;
my $i18n = WebGUI::International->new($session, 'WebGUI');
if (! $asset->canEdit) {
diff --git a/lib/WebGUI/AssetHelper/Delete.pm b/lib/WebGUI/AssetHelper/Delete.pm
index 0c75a9ffc..624da9da9 100644
--- a/lib/WebGUI/AssetHelper/Delete.pm
+++ b/lib/WebGUI/AssetHelper/Delete.pm
@@ -33,14 +33,15 @@ These methods are available from this class:
#-------------------------------------------------------------------
-=head2 process ( $asset )
+=head2 process ()
Fork the Delete operation
=cut
sub process {
- my ($self, $asset) = @_;
+ my ($self) = @_;
+ my $asset = $self->asset;
my $session = $self->session;
my $i18n = WebGUI::International->new($session, 'WebGUI');
diff --git a/lib/WebGUI/AssetHelper/Duplicate.pm b/lib/WebGUI/AssetHelper/Duplicate.pm
index a9f7e0ae3..620ba924e 100644
--- a/lib/WebGUI/AssetHelper/Duplicate.pm
+++ b/lib/WebGUI/AssetHelper/Duplicate.pm
@@ -33,14 +33,15 @@ These methods are available from this class:
#-------------------------------------------------------------------
-=head2 process ( $asset )
+=head2 process ()
Fork the duplicate operation
=cut
sub process {
- my ($self, $asset) = @_;
+ my ($self) = @_;
+ my $asset = $self->asset;
my $session = $self->session;
# Should we autocommit?
diff --git a/lib/WebGUI/AssetHelper/EditBranch.pm b/lib/WebGUI/AssetHelper/EditBranch.pm
index b9310bece..2fd2138f7 100644
--- a/lib/WebGUI/AssetHelper/EditBranch.pm
+++ b/lib/WebGUI/AssetHelper/EditBranch.pm
@@ -34,15 +34,16 @@ These methods are available from this class:
#-------------------------------------------------------------------
-=head2 process ( $class, $asset )
+=head2 process ()
Opens a new tab for displaying the form and the output for editing a branch.
=cut
sub process {
- my ($class, $asset) = @_;
- my $session = $asset->session;
+ my ($self) = @_;
+ my $asset = $self->asset;
+ my $session = $self->session;
my $i18n = WebGUI::International->new($session, "Asset");
if (! $asset->canEdit) {
return {
@@ -51,7 +52,7 @@ sub process {
}
return {
- openDialog => '?op=assetHelper;className=' . $class . ';method=editBranch;assetId=' . $asset->getId,
+ openDialog => $self->getUrl( 'editBranch' ),
};
}
@@ -64,8 +65,9 @@ Creates a tabform to edit the Asset Tree. If canEdit returns False, returns insu
=cut
sub www_editBranch {
- my ($self, $asset) = @_;
- my $session = $asset->session;
+ my ($self) = @_;
+ my $asset = $self->asset;
+ my $session = $self->session;
my ( $style, $url ) = $session->quick( qw( style url ) );
$style->setCss( $url->extras('hoverhelp.css'));
$style->setScript( $url->extras('yui/build/yahoo-dom-event/yahoo-dom-event.js') );
@@ -312,8 +314,9 @@ Verifies proper inputs in the Asset Tree and saves them. Returns ManageAssets me
=cut
sub www_editBranchSave {
- my ($self, $asset) = @_;
- my $session = $asset->session;
+ my ($self) = @_;
+ my $asset = $self->asset;
+ my $session = $self->session;
return $session->privilege->insufficient() unless ($asset->canEdit && $session->user->isInGroup('4'));
my $form = $session->form;
my %data;
diff --git a/lib/WebGUI/AssetHelper/ExportHtml.pm b/lib/WebGUI/AssetHelper/ExportHtml.pm
index 819861e72..4b96a0a06 100644
--- a/lib/WebGUI/AssetHelper/ExportHtml.pm
+++ b/lib/WebGUI/AssetHelper/ExportHtml.pm
@@ -34,15 +34,16 @@ These methods are available from this class:
#-------------------------------------------------------------------
-=head2 process ( $asset )
+=head2 process ()
Opens a new tab for displaying the form and the output for exporting a branch.
=cut
sub process {
- my ($self, $asset) = @_;
- my $session = $asset->session;
+ my ($self) = @_;
+ my $asset = $self->asset;
+ my $session = $self->session;
my $i18n = WebGUI::International->new($session, "Asset");
if (! $asset->canEdit) {
return {
@@ -51,7 +52,7 @@ sub process {
}
return {
- openDialog => '?op=assetHelper;helperId=' . $self->id . ';method=export;assetId=' . $asset->getId,
+ openDialog => $self->getUrl( 'export' ),
};
}
@@ -64,8 +65,9 @@ Displays the export page administrative interface
=cut
sub www_export {
- my ($self, $asset) = @_;
- my $session = $asset->session;
+ my ($self) = @_;
+ my $asset = $self->asset;
+ my $session = $self->session;
return $session->privilege->insufficient() unless ($session->user->isInGroup(13));
my ( $style, $url ) = $session->quick(qw{ style url });
$style->setCss( $url->extras('hoverhelp.css'));
@@ -79,14 +81,7 @@ sub www_export {
ENDHTML
my $i18n = WebGUI::International->new($session, "Asset");
- my $f = WebGUI::FormBuilder->new($session, action => $asset->getUrl);
- $f->addField( "hidden", name => 'op', value => 'assetHelper' );
- $f->addField( "hidden", name => 'helperId', value => $self->id );
- $f->addField( "hidden", name => 'assetId', value => $asset->getId );
- $f->addField( "hidden",
- name => "method",
- value => "exportStatus"
- );
+ my $f = $self->getForm( 'exportStatus' );
$f->addField( "integer",
label => $i18n->get('Depth'),
hoverHelp => $i18n->get('Depth description'),
@@ -155,8 +150,9 @@ Displays the export status page
=cut
sub www_exportStatus {
- my ($self, $asset) = @_;
- my $session = $asset->session;
+ my ($self) = @_;
+ my $asset = $self->asset;
+ my $session = $self->session;
return $session->privilege->insufficient
unless $session->user->isInGroup(13);
my $form = $session->form;
diff --git a/lib/WebGUI/AssetHelper/Lock.pm b/lib/WebGUI/AssetHelper/Lock.pm
index 898bf3c14..896470237 100644
--- a/lib/WebGUI/AssetHelper/Lock.pm
+++ b/lib/WebGUI/AssetHelper/Lock.pm
@@ -33,7 +33,7 @@ These methods are available from this class:
#-------------------------------------------------------------------
-=head2 process ( $asset )
+=head2 process ()
Locks the asset with a version tag. If the user cannot edit the asset, or the asset is
already locked, it returns an error message.
@@ -41,8 +41,9 @@ already locked, it returns an error message.
=cut
sub process {
- my ($self, $asset) = @_;
- my $session = $asset->session;
+ my ($self) = @_;
+ my $asset = $self->asset;
+ my $session = $self->session;
my $i18n = WebGUI::International->new($session, 'Asset');
if (! $asset->canEdit) {
diff --git a/lib/WebGUI/Content/Admin.pm b/lib/WebGUI/Content/Admin.pm
index 4101d8c62..a92f8e6f8 100644
--- a/lib/WebGUI/Content/Admin.pm
+++ b/lib/WebGUI/Content/Admin.pm
@@ -89,11 +89,11 @@ sub handler {
my $helperId = $session->form->get('helperId');
my $class = $asset->getHelpers->{ $helperId }->{ className };
WebGUI::Pluggable::load( $class );
- my $helper = $class->new( id => $helperId, session => $session );
+ my $helper = $class->new( id => $helperId, session => $session, asset => $asset );
my $method = $session->form->get('method') || "view";
if ( $helper->can( "www_" . $method ) ) {
- return $helper->can( "www_" . $method )->( $helper, $asset );
+ return $helper->can( "www_" . $method )->( $helper );
}
else {
$session->log->error( sprintf 'Invalid asset helper "%s" calling method "%s"', $helperId, $method );
diff --git a/t/AssetHelper/ChangeUrl.t b/t/AssetHelper/ChangeUrl.t
index 26e23d22c..966080c0c 100644
--- a/t/AssetHelper/ChangeUrl.t
+++ b/t/AssetHelper/ChangeUrl.t
@@ -35,7 +35,7 @@ my $asset = WebGUI::Test->asset->addChild( {
#----------------------------------------------------------------------------
# Check permissions
-my $helper = WebGUI::AssetHelper::ChangeUrl->new( id => 'change_url', session => $session );
+my $helper = WebGUI::AssetHelper::ChangeUrl->new( id => 'change_url', session => $session, asset => $asset );
$session->user({ userId => 1 });
my $output = $helper->process( $asset );
@@ -46,7 +46,7 @@ ok( $output->{error}, "Errors on bad permissions" );
# Change URL!
$session->user({ userId => 3 }); # By the power of grayskull!
-my $output = $helper->process( $asset );
+my $output = $helper->process;
cmp_deeply( $output, {
openDialog => all(
re( 'method=changeUrl' ),
diff --git a/t/AssetHelper/Copy.t b/t/AssetHelper/Copy.t
index a3a1852ab..d5f731066 100644
--- a/t/AssetHelper/Copy.t
+++ b/t/AssetHelper/Copy.t
@@ -37,13 +37,13 @@ plan tests => 2; # Increment this number for each test you create
my $output;
$session->setting->set( "versionTagMode" => "autoCommit" );
-my $helper = WebGUI::AssetHelper::Copy->new( id => 'copy', session => $session );
my $home = WebGUI::Asset->getDefault($session);
my $root = WebGUI::Asset->getRoot($session);
{
- $output = $helper->process($home);
+ my $helper = WebGUI::AssetHelper::Copy->new( id => 'copy', session => $session, asset => $home );
+ $output = $helper->process;
cmp_deeply(
$output,
{
diff --git a/t/AssetHelper/CopyBranch.t b/t/AssetHelper/CopyBranch.t
index 8e69179f6..ad6ab4f32 100644
--- a/t/AssetHelper/CopyBranch.t
+++ b/t/AssetHelper/CopyBranch.t
@@ -36,7 +36,6 @@ plan tests => 5; # Increment this number for each test you create
# put your tests here
my $output;
-my $helper = WebGUI::AssetHelper::CopyBranch->new( id => 'copy_branch', session => $session );
my $node = WebGUI::Asset->getImportNode($session);
my $root = WebGUI::Asset->getRoot( $session );
my $tag = WebGUI::VersionTag->getWorking( $session );
@@ -60,8 +59,8 @@ $tag->commit;
addToCleanup( $tag );
{
-
- $output = $helper->process($top);
+ my $helper = WebGUI::AssetHelper::CopyBranch->new( id => 'copy_branch', session => $session, asset => $top );
+ $output = $helper->process;
cmp_deeply(
$output,
{
diff --git a/t/AssetHelper/CreateShortcut.t b/t/AssetHelper/CreateShortcut.t
index c628418b5..0d8fd7225 100644
--- a/t/AssetHelper/CreateShortcut.t
+++ b/t/AssetHelper/CreateShortcut.t
@@ -31,12 +31,12 @@ my $session = WebGUI::Test->session;
# Tests
my $output;
-my $helper = WebGUI::AssetHelper::CreateShortcut->new( id => 'shortcut', session => $session );
my $import = WebGUI::Asset->getImportNode($session);
my $priv_page = WebGUI::Test->asset( groupIdView => '3' );
+my $helper = WebGUI::AssetHelper::CreateShortcut->new( id => 'shortcut', session => $session, asset => $priv_page );
$session->user({userId => 1});
-$output = $helper->process($priv_page);
+$output = $helper->process;
cmp_deeply(
$output,
{
@@ -49,7 +49,8 @@ $session->setting->set( versionTagMode => 'autoCommit' );
$session->setting->set( skipCommitComments => '1' );
$session->user({userId => 3});
my $safe_page = WebGUI::Test->asset;
-$output = $helper->process($safe_page);
+my $helper = WebGUI::AssetHelper::CreateShortcut->new( id => 'shortcut', session => $session, asset => $safe_page );
+$output = $helper->process;
cmp_deeply(
$output,
{
diff --git a/t/AssetHelper/Cut.t b/t/AssetHelper/Cut.t
index ea877635d..e2ceaeac8 100644
--- a/t/AssetHelper/Cut.t
+++ b/t/AssetHelper/Cut.t
@@ -31,11 +31,11 @@ my $session = WebGUI::Test->session;
# Tests
my $output;
-my $helper = WebGUI::AssetHelper::Cut->new( id => 'cut', session => $session );
my $import = WebGUI::Asset->getImportNode($session);
$session->user({userId => 1});
-$output = $helper->process($import);
+my $helper = WebGUI::AssetHelper::Cut->new( id => 'cut', session => $session, asset => $import );
+$output = $helper->process;
cmp_deeply(
$output,
{
@@ -45,7 +45,7 @@ cmp_deeply(
);
$session->user({userId => 3});
-$output = $helper->process($import);
+$output = $helper->process;
cmp_deeply(
$output,
{
@@ -55,7 +55,8 @@ cmp_deeply(
);
my $safe_page = $import->getFirstChild;
-$output = $helper->process($safe_page);
+my $helper = WebGUI::AssetHelper::Cut->new( id => 'cut', session => $session, asset => $safe_page );
+$output = $helper->process;
cmp_deeply(
$output,
{
diff --git a/t/AssetHelper/Delete.t b/t/AssetHelper/Delete.t
index 708e5bcde..5b54ba2d5 100644
--- a/t/AssetHelper/Delete.t
+++ b/t/AssetHelper/Delete.t
@@ -31,11 +31,11 @@ my $session = WebGUI::Test->session;
# Tests
my $output;
-my $helper = WebGUI::AssetHelper::Delete->new( id => 'Delete', session => $session );
my $import = WebGUI::Asset->getImportNode($session);
+my $helper = WebGUI::AssetHelper::Delete->new( id => 'Delete', session => $session, asset => $import );
$session->user({userId => 1});
-$output = $helper->process($import);
+$output = $helper->process;
cmp_deeply(
$output,
{
@@ -45,7 +45,7 @@ cmp_deeply(
);
$session->user({userId => 3});
-$output = $helper->process($import);
+$output = $helper->process;
cmp_deeply(
$output,
{
@@ -55,7 +55,8 @@ cmp_deeply(
);
my $safe_page = $import->getFirstChild;
-$output = $helper->process($safe_page);
+my $helper = WebGUI::AssetHelper::Delete->new( id => 'Delete', session => $session, asset => $safe_page );
+$output = $helper->process;
cmp_deeply(
$output,
{
diff --git a/t/AssetHelper/Duplicate.t b/t/AssetHelper/Duplicate.t
index 8059bc992..9f0cae243 100644
--- a/t/AssetHelper/Duplicate.t
+++ b/t/AssetHelper/Duplicate.t
@@ -37,13 +37,13 @@ plan tests => 2; # Increment this number for each test you create
my $output;
$session->setting->set( "versionTagMode" => "autoCommit" );
-my $helper = WebGUI::AssetHelper::Duplicate->new( id => 'duplicate', session => $session );
my $root = WebGUI::Test->asset;
my $test = $root->addChild( { className => 'WebGUI::Asset::Snippet' } );
+my $helper = WebGUI::AssetHelper::Duplicate->new( id => 'duplicate', session => $session, asset => $test );
{
- $output = $helper->process($test);
+ $output = $helper->process;
cmp_deeply(
$output,
{
diff --git a/t/AssetHelper/EditBranch.t b/t/AssetHelper/EditBranch.t
index 0dc3f0476..dffa92090 100644
--- a/t/AssetHelper/EditBranch.t
+++ b/t/AssetHelper/EditBranch.t
@@ -31,7 +31,6 @@ my $session = WebGUI::Test->session;
# Tests
my $output;
-my $helper = WebGUI::AssetHelper::EditBranch->new( id => 'edit_branch', session => $session );
my $node = WebGUI::Asset->getImportNode($session);
my $root = WebGUI::Asset->getRoot( $session );
my $top = $node->addChild({
@@ -54,8 +53,9 @@ $tag->commit;
WebGUI::Test->addToCleanup( $top, $child, $grand );
{
+ my $helper = WebGUI::AssetHelper::EditBranch->new( id => 'edit_branch', session => $session, asset => $top );
- $output = $helper->process($top);
+ $output = $helper->process;
cmp_deeply(
$output,
{
diff --git a/t/AssetHelper/ExportHtml.t b/t/AssetHelper/ExportHtml.t
index d8a73afb3..8025637ca 100644
--- a/t/AssetHelper/ExportHtml.t
+++ b/t/AssetHelper/ExportHtml.t
@@ -30,7 +30,6 @@ my $session = WebGUI::Test->session;
$session->user({ userId => 3 });
my $output;
-my $helper = WebGUI::AssetHelper::ExportHtml->new( id => 'export_html', session => $session );
my $node = WebGUI::Asset->getImportNode($session);
my $root = WebGUI::Asset->getRoot( $session );
my $top = $node->addChild({
@@ -62,7 +61,7 @@ WebGUI::Test->config->set( "exportPath" => $dir->dirname );
# Tests
{
-
+ my $helper = WebGUI::AssetHelper::ExportHtml->new( id => 'export_html', session => $session, asset => $top );
$output = $helper->process($top);
cmp_deeply(
$output,
diff --git a/t/AssetHelper/Lock.t b/t/AssetHelper/Lock.t
index 94be523ed..16f4583ce 100644
--- a/t/AssetHelper/Lock.t
+++ b/t/AssetHelper/Lock.t
@@ -45,9 +45,9 @@ my $newPage = $home->addChild({
$newPage = WebGUI::Asset->newById($session, $newPage->assetId);
-my $helper = WebGUI::AssetHelper::Lock->new( id => 'lock', session => $session );
+my $helper = WebGUI::AssetHelper::Lock->new( id => 'lock', session => $session, asset => $newPage );
$session->user({userId => 1});
-$output = $helper->process($newPage);
+$output = $helper->process;
cmp_deeply(
$output,
{
@@ -57,7 +57,7 @@ cmp_deeply(
);
$session->user({userId => 3});
-$output = $helper->process($newPage);
+$output = $helper->process;
cmp_deeply(
$output,
{
@@ -70,8 +70,9 @@ $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';
+$helper = WebGUI::AssetHelper::Lock->new( id => 'lock', session => $session, asset => $newPage );
$session->user({userId => $editor->getId});
-$output = $helper->process($newPage);
+$output = $helper->process;
cmp_deeply(
$output,
{