Copy Asset Helper (self only).

This commit is contained in:
Colin Kuskie 2009-11-25 16:32:52 -08:00
parent ed8f2c4a8f
commit 7298af49ea
3 changed files with 161 additions and 0 deletions

73
t/AssetHelper/Copy.t Normal file
View file

@ -0,0 +1,73 @@
# vim:syntax=perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#------------------------------------------------------------------
# Write a little about what this script tests.
#
#
use FindBin;
use strict;
use lib "$FindBin::Bin/../lib";
use Test::More;
use Test::Deep;
use WebGUI::Test; # Must use this before any other WebGUI modules
use WebGUI::Session;
use WebGUI::Asset;
use WebGUI::AssetHelper::Copy;
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
plan tests => 3; # Increment this number for each test you create
#----------------------------------------------------------------------------
# put your tests here
my $output;
my $home = WebGUI::Asset->getDefault($session);
$output = WebGUI::AssetHelper::Copy->process($home);
cmp_deeply(
$output,
{
message => re('was copied to the clipboard'),
},
'AssetHelper/Copy redirects the back to the copied asset'
);
my $clippies = $home->getAssetsInClipboard();
is @{ $clippies }, 1, '... only copied 1 asset to the clipboard, no children';
foreach my $asset (@{ $clippies }) {
$asset->purge;
}
$session->setting->set('skipCommitComments', 0);
$output = WebGUI::AssetHelper::Copy->process($home);
cmp_deeply(
$output,
{
message => re('was copied to the clipboard'),
open_tab => $home->getUrl,
},
'AssetHelper/Copy opens a tab for commit comments'
);
foreach my $asset (@{ $clippies }) {
$asset->purge;
}
#vim:ft=perl