moving into sub folders
This commit is contained in:
parent
175871d7b7
commit
dc74b0da8d
6 changed files with 16 additions and 16 deletions
77
t/Form/GetName.t
Normal file
77
t/Form/GetName.t
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2005 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
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
# ---- BEGIN DO NOT EDIT ----
|
||||
use strict;
|
||||
use lib '../../lib';
|
||||
use Getopt::Long;
|
||||
use WebGUI::Form::FieldType;
|
||||
use WebGUI::Form::DynamicField;
|
||||
use WebGUI::Session;
|
||||
use Data::Dumper;
|
||||
# ---- END DO NOT EDIT ----
|
||||
|
||||
#The goal of this test is to verify that getName works with all Form types.
|
||||
#getName is now inherited by all Forms and pulls the internationalized ID
|
||||
#from sub definition.
|
||||
#It would be nice to have a way to automatically verify that each Form has
|
||||
#the correct name, but it would have to be table driven.
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
|
||||
my $numTests = 0;
|
||||
|
||||
my $session = initialize(); # this line is required
|
||||
|
||||
# put your tests here
|
||||
|
||||
diag("Getting the list of all Form types\n");
|
||||
|
||||
my @formTypes = sort @{ WebGUI::Form::FieldType->getTypes($session) };
|
||||
|
||||
##We have to remove DynamicField from this list, since when you call new
|
||||
##it wants to return a type. We'll check it manually.
|
||||
|
||||
$numTests = (2 * scalar @formTypes) + 1;
|
||||
|
||||
plan tests => $numTests;
|
||||
|
||||
diag("Planning on running $numTests tests\n");
|
||||
|
||||
foreach my $formType (@formTypes) {
|
||||
my $form = WebGUI::Form::DynamicField->new($session, fieldType => $formType);
|
||||
my $ref = (split /::/, ref $form)[-1];
|
||||
is($ref, $formType, "checking form type $formType");
|
||||
ok($form->getName($session), sprintf "form getName = %s", $form->getName($session));
|
||||
}
|
||||
|
||||
my $name = WebGUI::Form::DynamicField->getName($session);
|
||||
|
||||
ok($name, 'did not inherit default form name');
|
||||
|
||||
cleanup($session); # this line is required
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE -----
|
||||
|
||||
sub initialize {
|
||||
$|=1; # disable output buffering
|
||||
my $configFile;
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile
|
||||
);
|
||||
exit 1 unless ($configFile);
|
||||
my $session = WebGUI::Session->open("../..",$configFile);
|
||||
}
|
||||
|
||||
sub cleanup {
|
||||
my $session = shift;
|
||||
$session->close();
|
||||
}
|
||||
|
||||
445
t/Form/ListEquiv.t
Normal file
445
t/Form/ListEquiv.t
Normal file
|
|
@ -0,0 +1,445 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2005 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
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
# ---- BEGIN DO NOT EDIT ----
|
||||
use strict;
|
||||
use lib '../../lib';
|
||||
use Getopt::Long;
|
||||
use WebGUI::Form::DynamicField;
|
||||
use WebGUI::Form::SelectList;
|
||||
use WebGUI::Session;
|
||||
use Data::Dumper;
|
||||
# ---- END DO NOT EDIT ----
|
||||
|
||||
#The goal of this test is to verify that all SelectList type Forms
|
||||
#can be generated directly and via DynamicField
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
|
||||
##In general, there should be many tests for each form type
|
||||
# Object creation, direct
|
||||
# Object creation, DynamicField
|
||||
# sortByName set for direct
|
||||
# sortByName set for dynamic
|
||||
# getName set for direct
|
||||
# compare output of toHtml from both objects
|
||||
# compare output of toHtmlWithWrapper from both objects
|
||||
my $numTests = 8*14;
|
||||
|
||||
my $session = initialize(); # this line is required
|
||||
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
|
||||
# put your tests here
|
||||
|
||||
diag("Planning on running $numTests tests\n");
|
||||
|
||||
plan tests => $numTests;
|
||||
|
||||
diag("SelectList, simple equivalency with size");
|
||||
|
||||
my ($direct, $dynamic);
|
||||
|
||||
$dynamic = WebGUI::Form::DynamicField->new(
|
||||
$session,
|
||||
fieldType => 'SelectList',
|
||||
name => 'mySelectList',
|
||||
label => 'list of selections',
|
||||
possibleValues => join("\n", qw(a b c d e f g h)),
|
||||
value => join("\n", qw(a e c g)),
|
||||
sortByValue => 1,
|
||||
multiple => 1,
|
||||
);
|
||||
$direct = WebGUI::Form::SelectList->new($session,{
|
||||
name => 'mySelectList',
|
||||
label => 'list of selections',
|
||||
options => { a=>'a', b=>'b', c=>'c', d=>'d', e=>'e', f=>'f', g=>'g', h=>'h', },
|
||||
value => [ qw(a c e g) ],
|
||||
sortByValue => 1,
|
||||
multiple => 1,
|
||||
});
|
||||
|
||||
is(ref $dynamic, "WebGUI::Form::SelectList", 'checking dynamic SelectList');
|
||||
is(ref $direct, "WebGUI::Form::SelectList", 'checking direct SelectList');
|
||||
is($direct->getName($session), $i18n->get('484','WebGUI'), 'Check getName');
|
||||
is($dynamic->get('sortByValue'), 1, 'dynamic CheckList was assigned sortByValue');
|
||||
is($direct->get('sortByValue'), 1, 'direct CheckList was assigned sortByValue');
|
||||
is($dynamic->toHtml, $direct->toHtml, "matching output, toHtml");
|
||||
is($dynamic->toHtmlWithWrapper, $direct->toHtmlWithWrapper, "matching SelectList output, toHtmlWithWrapper");
|
||||
is($dynamic->toHtmlAsHidden, $direct->toHtmlAsHidden, "matching SelectList output, toHtmlAsHidden");
|
||||
|
||||
diag("CheckList, simple equivalency");
|
||||
|
||||
$dynamic = WebGUI::Form::DynamicField->new(
|
||||
$session,
|
||||
fieldType => 'CheckList',
|
||||
name => 'myCheckList',
|
||||
label => 'list of selections',
|
||||
possibleValues => join("\n", qw(a b c d e f g h)),
|
||||
value => join("\n", qw(a c e g)),
|
||||
sortByValue => 1,
|
||||
);
|
||||
$direct = WebGUI::Form::CheckList->new($session,{
|
||||
name => 'myCheckList',
|
||||
label => 'list of selections',
|
||||
options => { a=>'a', b=>'b', c=>'c', d=>'d', e=>'e', f=>'f', g=>'g', h=>'h', },
|
||||
value => [ qw(a c e g) ],
|
||||
sortByValue => 1,
|
||||
});
|
||||
|
||||
is(ref $dynamic, "WebGUI::Form::CheckList", 'checking dynamic CheckList');
|
||||
is(ref $direct, "WebGUI::Form::CheckList", 'checking direct CheckList');
|
||||
is($direct->getName($session), $i18n->get('941','WebGUI'), 'Check getName');
|
||||
is($dynamic->get('sortByValue'), 1, 'dynamic CheckList was assigned sortByValue');
|
||||
is($direct->get('sortByValue'), 1, 'direct CheckList was assigned sortByValue');
|
||||
is($dynamic->toHtml, $direct->toHtml, "matching CheckList output, toHtml");
|
||||
is($dynamic->toHtmlWithWrapper, $direct->toHtmlWithWrapper, "matching CheckList output, toHtmlWithWrapper");
|
||||
is($dynamic->toHtmlAsHidden, $direct->toHtmlAsHidden, "matching CheckList output, toHtmlAsHidden");
|
||||
|
||||
diag("RadioList, simple equivalency");
|
||||
|
||||
$dynamic = WebGUI::Form::DynamicField->new(
|
||||
$session,
|
||||
fieldType => 'RadioList',
|
||||
name => 'myRadioList',
|
||||
label => 'list of selections',
|
||||
possibleValues => join("\n", qw(a b c d e f g h)),
|
||||
value => 'b',
|
||||
sortByValue => 1,
|
||||
);
|
||||
$direct = WebGUI::Form::RadioList->new($session,{
|
||||
name => 'myRadioList',
|
||||
label => 'list of selections',
|
||||
options => { a=>'a', b=>'b', c=>'c', d=>'d', e=>'e', f=>'f', g=>'g', h=>'h', },
|
||||
value => 'b',
|
||||
sortByValue => 1,
|
||||
});
|
||||
|
||||
is(ref $dynamic, "WebGUI::Form::RadioList", 'checking dynamic RadioList');
|
||||
is(ref $direct, "WebGUI::Form::RadioList", 'checking direct RadioList');
|
||||
is($direct->getName($session), $i18n->get('942','WebGUI'), 'Radio getName');
|
||||
is($dynamic->get('sortByValue'), 1, 'dynamic RadioList was assigned sortByValue');
|
||||
is($direct->get('sortByValue'), 1, 'direct RadioList was assigned sortByValue');
|
||||
is($dynamic->toHtml, $direct->toHtml, "matching RadioList output, toHtml");
|
||||
is($dynamic->toHtmlWithWrapper, $direct->toHtmlWithWrapper, "matching RadioList output, toHtmlWithWrapper");
|
||||
is($dynamic->toHtmlAsHidden, $direct->toHtmlAsHidden, "matching RadioList output, toHtmlAsHidden");
|
||||
|
||||
diag("SelectBox, simple equivalency");
|
||||
|
||||
$dynamic = WebGUI::Form::DynamicField->new(
|
||||
$session,
|
||||
fieldType => 'SelectBox',
|
||||
name => 'mySelectBox',
|
||||
label => 'list of selections',
|
||||
possibleValues => join("\n", qw(a b c d e f g h)),
|
||||
value => 'b',
|
||||
sortByValue => 1,
|
||||
);
|
||||
$direct = WebGUI::Form::SelectBox->new($session,{
|
||||
name => 'mySelectBox',
|
||||
label => 'list of selections',
|
||||
options => { a=>'a', b=>'b', c=>'c', d=>'d', e=>'e', f=>'f', g=>'g', h=>'h', },
|
||||
value => 'b',
|
||||
sortByValue => 1,
|
||||
});
|
||||
|
||||
is(ref $dynamic, "WebGUI::Form::SelectBox", 'checking dynamic SelectBox');
|
||||
is(ref $direct, "WebGUI::Form::SelectBox", 'checking direct SelectBox');
|
||||
is($direct->getName($session), $i18n->get('487','WebGUI'), 'SelectBox getName');
|
||||
is($dynamic->get('sortByValue'), 1, 'dynamic SelectBox was assigned sortByValue');
|
||||
is($direct->get('sortByValue'), 1, 'direct SelectBox was assigned sortByValue');
|
||||
is($dynamic->toHtml, $direct->toHtml, "matching SelectBox output, toHtml");
|
||||
is($dynamic->toHtmlWithWrapper, $direct->toHtmlWithWrapper, "matching SelectBox output, toHtmlWithWrapper");
|
||||
is($dynamic->toHtmlAsHidden, $direct->toHtmlAsHidden, "matching SelectBox output, toHtmlAsHidden");
|
||||
|
||||
diag("HiddenList, simple equivalency");
|
||||
|
||||
$dynamic = WebGUI::Form::DynamicField->new(
|
||||
$session,
|
||||
fieldType => 'HiddenList',
|
||||
name => 'myHiddenList',
|
||||
label => 'list of groups',
|
||||
sortByValue => 1,
|
||||
);
|
||||
$direct = WebGUI::Form::HiddenList->new($session,{
|
||||
name => 'myHiddenList',
|
||||
label => 'list of groups',
|
||||
sortByValue => 1,
|
||||
});
|
||||
|
||||
#diag("direct" . Dumper($direct));
|
||||
#diag("dynamic" . Dumper($dynamic));
|
||||
|
||||
is(ref $dynamic, "WebGUI::Form::HiddenList", 'checking dynamic HiddenList');
|
||||
is(ref $direct, "WebGUI::Form::HiddenList", 'checking direct HiddenList');
|
||||
is($direct->getName($session), $i18n->get('hidden list','WebGUI'), 'HiddenList getName');
|
||||
is($dynamic->get('sortByValue'), 1, 'dynamic HiddenList was assigned sortByValue');
|
||||
is($direct->get('sortByValue'), 1, 'direct HiddenList was assigned sortByValue');
|
||||
is($dynamic->toHtml, $direct->toHtml, "matching HiddenList output, toHtml");
|
||||
is($dynamic->toHtmlWithWrapper, $direct->toHtmlWithWrapper, "matching HiddenList output, toHtmlWithWrapper");
|
||||
is($dynamic->toHtmlAsHidden, $direct->toHtmlAsHidden, "matching HiddenList output, toHtmlAsHidden");
|
||||
|
||||
diag("Group, simple equivalency");
|
||||
|
||||
$dynamic = WebGUI::Form::DynamicField->new(
|
||||
$session,
|
||||
fieldType => 'Group',
|
||||
name => 'myGroup',
|
||||
label => 'list of groups',
|
||||
sortByValue => 1,
|
||||
);
|
||||
$direct = WebGUI::Form::Group->new($session,{
|
||||
name => 'myGroup',
|
||||
label => 'list of groups',
|
||||
sortByValue => 1,
|
||||
});
|
||||
|
||||
#diag("direct" . Dumper($direct));
|
||||
#diag("dynamic" . Dumper($dynamic));
|
||||
|
||||
is(ref $dynamic, "WebGUI::Form::Group", 'checking dynamic Group');
|
||||
is(ref $direct, "WebGUI::Form::Group", 'checking direct Group');
|
||||
is($direct->getName($session), $i18n->get('group','WebGUI'), 'Group getName');
|
||||
is($dynamic->get('sortByValue'), 1, 'dynamic Group was assigned sortByValue');
|
||||
is($direct->get('sortByValue'), 1, 'direct Group was assigned sortByValue');
|
||||
is($dynamic->toHtml, $direct->toHtml, "matching Group output, toHtml");
|
||||
is($dynamic->toHtmlWithWrapper, $direct->toHtmlWithWrapper, "matching Group output, toHtmlWithWrapper");
|
||||
is($dynamic->toHtmlAsHidden, $direct->toHtmlAsHidden, "matching Group output, toHtmlAsHidden");
|
||||
|
||||
diag("Group, simple equivalency, no default values");
|
||||
|
||||
$dynamic = WebGUI::Form::DynamicField->new(
|
||||
$session,
|
||||
fieldType => 'Group',
|
||||
name => 'myGroup',
|
||||
label => 'list of groups',
|
||||
sortByValue => 1,
|
||||
value => '',
|
||||
);
|
||||
$direct = WebGUI::Form::Group->new($session,{
|
||||
name => 'myGroup',
|
||||
label => 'list of groups',
|
||||
sortByValue => 1,
|
||||
value => '',
|
||||
});
|
||||
|
||||
#diag("direct" . Dumper($direct));
|
||||
#diag("dynamic" . Dumper($dynamic));
|
||||
|
||||
is(ref $dynamic, "WebGUI::Form::Group", 'checking dynamic Group');
|
||||
is(ref $direct, "WebGUI::Form::Group", 'checking direct Group');
|
||||
is($direct->getName($session), $i18n->get('group','WebGUI'), 'Group getName');
|
||||
is($dynamic->get('sortByValue'), 1, 'dynamic Group was assigned sortByValue');
|
||||
is($direct->get('sortByValue'), 1, 'direct Group was assigned sortByValue');
|
||||
is($dynamic->toHtml, $direct->toHtml, "matching Group output, toHtml");
|
||||
is($dynamic->toHtmlWithWrapper, $direct->toHtmlWithWrapper, "matching Group output, toHtmlWithWrapper");
|
||||
is($dynamic->toHtmlAsHidden, $direct->toHtmlAsHidden, "matching Group output, toHtmlAsHidden");
|
||||
|
||||
|
||||
diag("TimeZone, simple equivalency");
|
||||
|
||||
$dynamic = WebGUI::Form::DynamicField->new(
|
||||
$session,
|
||||
fieldType => 'TimeZone',
|
||||
name => 'myTimeZone',
|
||||
label => 'list of time zones',
|
||||
sortByValue => 1,
|
||||
);
|
||||
$direct = WebGUI::Form::TimeZone->new($session,{
|
||||
name => 'myTimeZone',
|
||||
label => 'list of time zones',
|
||||
sortByValue => 1,
|
||||
});
|
||||
|
||||
#diag("direct" . Dumper($direct));
|
||||
#diag("dynamic" . Dumper($dynamic));
|
||||
|
||||
is(ref $dynamic, "WebGUI::Form::TimeZone", 'checking dynamic TimeZone');
|
||||
is(ref $direct, "WebGUI::Form::TimeZone", 'checking direct TimeZone');
|
||||
is($direct->getName($session), $i18n->get('timezone','DateTime'), 'TimeZone getName');
|
||||
is($dynamic->get('sortByValue'), 1, 'dynamic TimeZone was assigned sortByValue');
|
||||
is($direct->get('sortByValue'), 1, 'direct TimeZone was assigned sortByValue');
|
||||
is($dynamic->toHtml, $direct->toHtml, "matching TimeZone output, toHtml");
|
||||
is($dynamic->toHtmlWithWrapper, $direct->toHtmlWithWrapper, "matching TimeZone output, toHtmlWithWrapper");
|
||||
is($dynamic->toHtmlAsHidden, $direct->toHtmlAsHidden, "matching TimeZone output, toHtmlAsHidden");
|
||||
|
||||
diag("ContentType, simple equivalency");
|
||||
|
||||
$dynamic = WebGUI::Form::DynamicField->new(
|
||||
$session,
|
||||
fieldType => 'ContentType',
|
||||
name => 'myContentType',
|
||||
label => 'list of content types',
|
||||
sortByValue => 1,
|
||||
);
|
||||
$direct = WebGUI::Form::ContentType->new($session,{
|
||||
name => 'myContentType',
|
||||
label => 'list of content types',
|
||||
sortByValue => 1,
|
||||
});
|
||||
|
||||
is(ref $dynamic, "WebGUI::Form::ContentType", 'checking dynamic ContentType');
|
||||
is(ref $direct, "WebGUI::Form::ContentType", 'checking direct ContentType');
|
||||
is($direct->getName($session), $i18n->get('1007','WebGUI'), 'ContentType getName');
|
||||
is($dynamic->get('sortByValue'), 1, 'dynamic ContentType was assigned sortByValue');
|
||||
is($direct->get('sortByValue'), 1, 'direct ContentType was assigned sortByValue');
|
||||
is($dynamic->toHtml, $direct->toHtml, "matching ContentType output, toHtml");
|
||||
is($dynamic->toHtmlWithWrapper, $direct->toHtmlWithWrapper, "matching ContentType output, toHtmlWithWrapper");
|
||||
is($dynamic->toHtmlAsHidden, $direct->toHtmlAsHidden, "matching ContentType output, toHtmlAsHidden");
|
||||
|
||||
diag("FilterContent, simple equivalency");
|
||||
|
||||
$dynamic = WebGUI::Form::DynamicField->new(
|
||||
$session,
|
||||
fieldType => 'FilterContent',
|
||||
name => 'myFilterContent',
|
||||
label => 'list of types to filter',
|
||||
sortByValue => 1,
|
||||
);
|
||||
$direct = WebGUI::Form::FilterContent->new($session,{
|
||||
name => 'myFilterContent',
|
||||
label => 'list of types to filter',
|
||||
sortByValue => 1,
|
||||
});
|
||||
|
||||
is(ref $dynamic, "WebGUI::Form::FilterContent", 'checking dynamic FilterContent');
|
||||
is(ref $direct, "WebGUI::Form::FilterContent", 'checking direct FilterContent');
|
||||
is($direct->getName($session), $i18n->get('418','WebGUI'), 'FilterContent getName');
|
||||
is($dynamic->get('sortByValue'), 1, 'dynamic FilterContent was assigned sortByValue');
|
||||
is($direct->get('sortByValue'), 1, 'direct FilterContent was assigned sortByValue');
|
||||
is($dynamic->toHtml, $direct->toHtml, "matching FilterContent output, toHtml");
|
||||
is($dynamic->toHtmlWithWrapper, $direct->toHtmlWithWrapper, "matching FilterContent output, toHtmlWithWrapper");
|
||||
is($dynamic->toHtmlAsHidden, $direct->toHtmlAsHidden, "matching FilterContent output, toHtmlAsHidden");
|
||||
|
||||
diag("LdapLink, simple equivalency");
|
||||
|
||||
$dynamic = WebGUI::Form::DynamicField->new(
|
||||
$session,
|
||||
fieldType => 'LdapLink',
|
||||
name => 'myLdapLink',
|
||||
label => 'list of ldap links',
|
||||
sortByValue => 1,
|
||||
);
|
||||
$direct = WebGUI::Form::LdapLink->new($session,{
|
||||
name => 'myLdapLink',
|
||||
label => 'list of ldap links',
|
||||
sortByValue => 1,
|
||||
});
|
||||
|
||||
#diag("direct" . Dumper($direct));
|
||||
#diag("dynamic" . Dumper($dynamic));
|
||||
|
||||
is(ref $dynamic, "WebGUI::Form::LdapLink", 'checking dynamic LdapLink');
|
||||
is(ref $direct, "WebGUI::Form::LdapLink", 'checking direct LdapLink');
|
||||
is($direct->getName($session), $i18n->get("LDAPLink_1075","AuthLDAP"), 'LdapLink getName');
|
||||
is($dynamic->get('sortByValue'), 1, 'dynamic LdapLink was assigned sortByValue');
|
||||
is($direct->get('sortByValue'), 1, 'direct LdapLink was assigned sortByValue');
|
||||
is($dynamic->toHtml, $direct->toHtml, "matching LdapLink output, toHtml");
|
||||
is($dynamic->toHtmlWithWrapper, $direct->toHtmlWithWrapper, "matching LdapLink output, toHtmlWithWrapper");
|
||||
is($dynamic->toHtmlAsHidden, $direct->toHtmlAsHidden, "matching LdapLink output, toHtmlAsHidden");
|
||||
|
||||
diag("Template, simple equivalency");
|
||||
|
||||
$dynamic = WebGUI::Form::DynamicField->new(
|
||||
$session,
|
||||
fieldType => 'Template',
|
||||
name => 'myTemplate',
|
||||
label => 'list of ldap links',
|
||||
sortByValue => 1,
|
||||
);
|
||||
$direct = WebGUI::Form::Template->new($session,{
|
||||
name => 'myTemplate',
|
||||
label => 'list of ldap links',
|
||||
sortByValue => 1,
|
||||
});
|
||||
|
||||
#diag("direct" . Dumper($direct));
|
||||
#diag("dynamic" . Dumper($dynamic));
|
||||
|
||||
is(ref $dynamic, "WebGUI::Form::Template", 'checking dynamic Template');
|
||||
is(ref $direct, "WebGUI::Form::Template", 'checking direct Template');
|
||||
is($direct->getName($session), $i18n->get("assetName","Asset_Template"), 'Template getName');
|
||||
is($dynamic->get('sortByValue'), 1, 'dynamic Template was assigned sortByValue');
|
||||
is($direct->get('sortByValue'), 1, 'direct Template was assigned sortByValue');
|
||||
is($dynamic->toHtml, $direct->toHtml, "matching Template output, toHtml");
|
||||
is($dynamic->toHtmlWithWrapper, $direct->toHtmlWithWrapper, "matching Template output, toHtmlWithWrapper");
|
||||
is($dynamic->toHtmlAsHidden, $direct->toHtmlAsHidden, "matching Template output, toHtmlAsHidden");
|
||||
|
||||
diag("WhatNext, simple equivalency");
|
||||
|
||||
$dynamic = WebGUI::Form::DynamicField->new(
|
||||
$session,
|
||||
fieldType => 'WhatNext',
|
||||
name => 'myWhatNext',
|
||||
label => 'list of what to do next',
|
||||
sortByValue => 1,
|
||||
);
|
||||
$direct = WebGUI::Form::WhatNext->new($session,{
|
||||
name => 'myWhatNext',
|
||||
label => 'list of what to do next',
|
||||
sortByValue => 1,
|
||||
});
|
||||
|
||||
#diag("direct" . Dumper($direct));
|
||||
#diag("dynamic" . Dumper($dynamic));
|
||||
|
||||
is(ref $dynamic, "WebGUI::Form::WhatNext", 'checking dynamic WhatNext');
|
||||
is(ref $direct, "WebGUI::Form::WhatNext", 'checking direct WhatNext');
|
||||
is($direct->getName($session), $i18n->get('744','WebGUI'), 'WhatNext getName');
|
||||
is($dynamic->get('sortByValue'), 1, 'dynamic WhatNext was assigned sortByValue');
|
||||
is($direct->get('sortByValue'), 1, 'direct WhatNext was assigned sortByValue');
|
||||
is($dynamic->toHtml, $direct->toHtml, "matching WhatNext output, toHtml");
|
||||
is($dynamic->toHtmlWithWrapper, $direct->toHtmlWithWrapper, "matching WhatNext output, toHtmlWithWrapper");
|
||||
is($dynamic->toHtmlAsHidden, $direct->toHtmlAsHidden, "matching WhatNext output, toHtmlAsHidden");
|
||||
|
||||
diag("DatabaseLink, simple equivalency");
|
||||
|
||||
$dynamic = WebGUI::Form::DynamicField->new(
|
||||
$session,
|
||||
fieldType => 'DatabaseLink',
|
||||
name => 'myDatabaseLink',
|
||||
label => 'list of databases',
|
||||
sortByValue => 1,
|
||||
);
|
||||
$direct = WebGUI::Form::DatabaseLink->new($session,{
|
||||
name => 'myDatabaseLink',
|
||||
label => 'list of databases',
|
||||
sortByValue => 1,
|
||||
});
|
||||
|
||||
is(ref $dynamic, "WebGUI::Form::DatabaseLink", 'checking dynamic DatabaseLink');
|
||||
is(ref $direct, "WebGUI::Form::DatabaseLink", 'checking direct DatabaseLink');
|
||||
is($direct->getName($session), $i18n->get('1075','WebGUI'), 'DatabaseLink getName');
|
||||
is($dynamic->get('sortByValue'), 1, 'dynamic DatabaseLink was assigned sortByValue');
|
||||
is($direct->get('sortByValue'), 1, 'direct DatabaseLink was assigned sortByValue');
|
||||
is($dynamic->toHtml, $direct->toHtml, "matching DatabaseLink output, toHtml");
|
||||
is($dynamic->toHtmlWithWrapper, $direct->toHtmlWithWrapper, "matching DatabaseLink output, toHtmlWithWrapper");
|
||||
is($dynamic->toHtmlAsHidden, $direct->toHtmlAsHidden, "matching DatabaseLink output, toHtmlAsHidden");
|
||||
|
||||
|
||||
cleanup($session); # this line is required
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE -----
|
||||
|
||||
sub initialize {
|
||||
$|=1; # disable output buffering
|
||||
my $configFile;
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile
|
||||
);
|
||||
exit 1 unless ($configFile);
|
||||
my $session = WebGUI::Session->open("../..",$configFile);
|
||||
}
|
||||
|
||||
sub cleanup {
|
||||
my $session = shift;
|
||||
$session->close();
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue