Begin Test::Class suite for Forms
This commit is contained in:
parent
726707dd2e
commit
7e136f6047
5 changed files with 158 additions and 0 deletions
66
t/tests/Test/WebGUI/Form/Control.pm
Normal file
66
t/tests/Test/WebGUI/Form/Control.pm
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
package Test::WebGUI::Form::Control;
|
||||
#-------------------------------------------------------------------
|
||||
# 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
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use base qw/My::Test::Class/;
|
||||
|
||||
use Test::More;
|
||||
use Test::Deep;
|
||||
use Test::Exception;
|
||||
use WebGUI::Test;
|
||||
use Data::Dumper;
|
||||
use List::MoreUtils;
|
||||
|
||||
sub _constructor : Test(2) {
|
||||
my $test = shift;
|
||||
my $session = $test->session;
|
||||
|
||||
my $form = $test->class->new($session);
|
||||
|
||||
note "new for ". $test->class;
|
||||
isa_ok $form, $test->class;
|
||||
isa_ok $form->session, 'WebGUI::Session';
|
||||
}
|
||||
|
||||
sub t_00_get_set : Test(2) {
|
||||
my $test = shift;
|
||||
my $session = $test->session;
|
||||
|
||||
my $form = $test->class->new($session);
|
||||
|
||||
lives_ok { $form->set('name', 'form1'); } 'set name';
|
||||
is $form->get('name'), 'form1', 'get name';
|
||||
|
||||
}
|
||||
|
||||
sub t_01_instanced : Test(1) {
|
||||
my $test = shift;
|
||||
my $session = $test->session;
|
||||
|
||||
my $form = $test->class->new($session, {
|
||||
name => 'form1',
|
||||
});
|
||||
|
||||
is $form->get('name'), 'form1', 'name set on instanciation';
|
||||
}
|
||||
|
||||
sub t_02_method_check : Test(1) {
|
||||
my $test = shift;
|
||||
my $session = $test->session;
|
||||
|
||||
my $form = $test->class->new($session);
|
||||
|
||||
can_ok $form, 'headTags';
|
||||
}
|
||||
|
||||
1;
|
||||
19
t/tests/Test/WebGUI/Form/Text.pm
Normal file
19
t/tests/Test/WebGUI/Form/Text.pm
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package Test::WebGUI::Form::Text;
|
||||
#-------------------------------------------------------------------
|
||||
# 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
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More;
|
||||
|
||||
use base qw/Test::WebGUI::Form::Control/;
|
||||
|
||||
1;
|
||||
19
t/tests/Test/WebGUI/Form/Url.pm
Normal file
19
t/tests/Test/WebGUI/Form/Url.pm
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package Test::WebGUI::Form::Url;
|
||||
#-------------------------------------------------------------------
|
||||
# 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
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More;
|
||||
|
||||
use base qw/Test::WebGUI::Form::Text/;
|
||||
|
||||
1;
|
||||
Loading…
Add table
Add a link
Reference in a new issue