forward port AdSpace tests from branch 7.4
This commit is contained in:
parent
53ac4be8d1
commit
9a8c3f2ddd
1 changed files with 75 additions and 0 deletions
75
t/Operation/AdSpace.t
Normal file
75
t/Operation/AdSpace.t
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
# vim:syntax=perl
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2007 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
|
||||
#------------------------------------------------------------------
|
||||
|
||||
# This tests the operation of saving the AdSpaces
|
||||
#
|
||||
#
|
||||
|
||||
use FindBin;
|
||||
use strict;
|
||||
use lib "$FindBin::Bin/../lib";
|
||||
use Test::More;
|
||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||
use WebGUI::Session;
|
||||
use WebGUI::AdSpace;
|
||||
use WebGUI::Operation::AdSpace;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my $adSpace;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 3; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test that AdSpace name can't have ']' characters in them
|
||||
|
||||
# Create an AdSpace to verify the saving
|
||||
$adSpace = WebGUI::AdSpace->create( $session, { name => 'oldname', } );
|
||||
|
||||
my $output
|
||||
= WebGUI::Test->getPage(
|
||||
'WebGUI::Operation::AdSpace::www_editAdSpaceSave',
|
||||
undef,
|
||||
{
|
||||
args => [ $session ],
|
||||
formParams => {
|
||||
adSpaceId => $adSpace->getId,
|
||||
name => 'This should ] fail',
|
||||
},
|
||||
userId => 3,
|
||||
},
|
||||
);
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/error/,
|
||||
"Notifies user that an error occurred",
|
||||
);
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/invalid/,
|
||||
"Notifies user what the error is",
|
||||
);
|
||||
|
||||
ok( $adSpace->get('name') eq 'oldname', 'AdSpace does not get saved.' );
|
||||
|
||||
$adSpace->delete;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Cleanup
|
||||
END {
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue