Merge commit 'bfe9780ce0' into WebGUI8. Merged up to 7.10.3
This commit is contained in:
commit
a90eadda7c
37 changed files with 537 additions and 92 deletions
|
|
@ -128,7 +128,7 @@ is(
|
|||
);
|
||||
|
||||
$date2 = WebGUI::Form::DateTime->new($session, {defaultValue => -1});
|
||||
is($date2->getValueAsHtml(), '12/31/1969 5:59 pm', "getValueAsHtml: defaultValue as negative epoch, returns as user's format");
|
||||
is($date2->getValueAsHtml(), '12/31/1969 5:59 pm', "getValueAsHtml: defaultValue as negative epoch, returns as user's format");
|
||||
is(
|
||||
getValueFromForm($session, $date2->toHtmlAsHidden),
|
||||
'1969-12-31 17:59:59',
|
||||
|
|
@ -156,7 +156,7 @@ is(
|
|||
|
||||
|
||||
$date2 = WebGUI::Form::DateTime->new($session, {defaultValue => '2008-08-01 11:34:26', value => $bday, });
|
||||
is($date2->getValueAsHtml(), '8/16/2001 8:00 am', "getValueAsHtml: defaultValue in mysql format, value as epoch returns value in user's format");
|
||||
is($date2->getValueAsHtml(), '8/16/2001 8:00 am', "getValueAsHtml: defaultValue in mysql format, value as epoch returns value in user's format");
|
||||
is(
|
||||
getValueFromForm($session, $date2->toHtmlAsHidden),
|
||||
'2001-08-16 08:00:00',
|
||||
|
|
|
|||
88
t/Form/Workflow.t
Normal file
88
t/Form/Workflow.t
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
#-------------------------------------------------------------------
|
||||
# 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 FindBin;
|
||||
use strict;
|
||||
use lib "$FindBin::Bin/../lib";
|
||||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::Form::Workflow;
|
||||
use WebGUI::Session;
|
||||
use HTML::Form;
|
||||
use WebGUI::Form_Checking;
|
||||
|
||||
#The goal of this test is to verify that SelectBox form elements work
|
||||
|
||||
use Test::More;
|
||||
use Test::Deep;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
# put your tests here
|
||||
|
||||
plan tests => 5;
|
||||
|
||||
my $plugin = WebGUI::Form::Workflow->new($session,{
|
||||
name => 'Workflowage',
|
||||
none => 1,
|
||||
noneLabel => 'none',
|
||||
#defaultValue => 'pbworkflow000000000006',
|
||||
defaultValue => '',
|
||||
type => 'WebGUI::VersionTag',
|
||||
value => '',
|
||||
});
|
||||
|
||||
is $plugin->getOriginalValue, '', 'value set to empty string';
|
||||
is $plugin->getDefaultValue, '', 'default value set to a valid workflow';
|
||||
|
||||
my ($header, $footer) = (WebGUI::Form::formHeader($session), WebGUI::Form::formFooter($session));
|
||||
|
||||
my $html = join "\n",
|
||||
$header,
|
||||
$plugin->toHtml;
|
||||
$footer;
|
||||
|
||||
diag $html;
|
||||
|
||||
my @forms = HTML::Form->parse($html, 'http://www.webgui.org');
|
||||
|
||||
##Test Form Generation
|
||||
|
||||
is(scalar @forms, 1, '1 form was parsed');
|
||||
|
||||
my $form = $forms[0];
|
||||
#use Data::Dumper;
|
||||
my @inputs = $form->inputs;
|
||||
is(scalar @inputs, 2, 'The form has 2 inputs');
|
||||
|
||||
my $input = $form->find_input('Workflowage');
|
||||
is($form->param('Workflowage'), '', 'Empty string is the default');
|
||||
|
||||
|
||||
###Test Form Output parsing
|
||||
#
|
||||
#WebGUI::Form_Checking::auto_check($session, $formType, $testBlock);
|
||||
#
|
||||
## test that we can process non-POST values correctly
|
||||
#my $cntl = WebGUI::Form::SelectBox->new($session,{ defaultValue => 4242 });
|
||||
#is($cntl->getValue('text'), 'text', 'getValue(text)');
|
||||
#is($cntl->getValue(42), 42, 'getValue(int)');
|
||||
#is($cntl->getValue(0), 0, 'zero');
|
||||
#is($cntl->getValue(''), '', '""');
|
||||
#is($cntl->getValue(1,2,3), 1, 'list returns first item');
|
||||
#is($session->form->selectBox(undef,'text'), 'text', 'text');
|
||||
#is($session->form->selectBox(undef,42), 42, 'int');
|
||||
#is($session->form->selectBox(undef,0), 0, 'zero');
|
||||
#is($session->form->selectBox(undef,undef), 0, 'undef returns 0');
|
||||
#is($session->form->selectBox(undef,''), '', '""');
|
||||
#is($session->form->selectBox(undef,1,2,3), 1, 'list returns first item');
|
||||
|
||||
|
||||
25
t/Inbox.t
25
t/Inbox.t
|
|
@ -15,13 +15,13 @@ use WebGUI::Session;
|
|||
use WebGUI::Inbox;
|
||||
use WebGUI::User;
|
||||
|
||||
use Test::More tests => 15; # increment this value for each test you create
|
||||
use Test::More tests => 20; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
# get a user so we can test retrieving messages for a specific user
|
||||
my $admin = WebGUI::User->new($session, 3);
|
||||
WebGUI::Test->addToCleanup(sub { WebGUI::Test->cleanupAdminInbox; });
|
||||
WebGUI::Test->addToCleanup(sub { WebGUI::Test->cleanupAdminInbox($session); });
|
||||
|
||||
# Begin tests by getting an inbox object
|
||||
my $inbox = WebGUI::Inbox->new($session);
|
||||
|
|
@ -130,4 +130,25 @@ my $messages = $inbox->getMessagesForUser($admin);
|
|||
$messages->[0]->setRead($admin->userId);
|
||||
is($inbox->getUnreadMessageCount($admin->userId), 3, '... really tracks unread messages');
|
||||
|
||||
is(scalar @{ $inbox->getMessagesForUser($admin) }, 4, 'Four messages in the inbox');
|
||||
$inbox->deleteMessagesForUser($admin);
|
||||
is(scalar @{ $inbox->getMessagesForUser($admin) }, 0, 'deleteMessagesForUser removed all messages');
|
||||
|
||||
my $dead_user = WebGUI::User->create($session);
|
||||
WebGUI::Test->addToCleanup($dead_user);
|
||||
$inbox->addMessage({
|
||||
message => "This method should be removed",
|
||||
userId => 3,
|
||||
sentBy => $dead_user->userId,
|
||||
status => 'unread',
|
||||
},{
|
||||
no_email => 1,
|
||||
});
|
||||
|
||||
is(scalar @{ $inbox->getMessagesForUser($admin) }, 1, 'one message from dead_user in the inbox');
|
||||
$dead_user->delete;
|
||||
is(scalar @{ $inbox->getMessagesForUser($admin) }, 1, '... after deleting the user, still 1 message');
|
||||
$inbox->deleteMessagesForUser($admin);
|
||||
is(scalar @{ $inbox->getMessagesForUser($admin) }, 0, '... after deleteMessagesForUser, all messages gone again');
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ my @testSets = (
|
|||
},
|
||||
{
|
||||
format => '',
|
||||
output =>'8/16/2001 8:00 am',
|
||||
output =>'8/16/2001 8:00 am',
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ is($output, $session->datetime->epochToHuman($time1), 'checking default time and
|
|||
|
||||
##Checking for edge case, time=0
|
||||
is WebGUI::Macro::D_date::process($session, '', 0),
|
||||
'12/31/1969 6:00 pm',
|
||||
'12/31/1969 6:00 pm',
|
||||
'...checking for handling time=0';
|
||||
|
||||
lives_ok { WebGUI::Macro::D_date::process($session, '', ' 0') }
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use File::Spec;
|
|||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
|
||||
use Test::More tests => 92; # increment this value for each test you create
|
||||
use Test::More tests => 95; # increment this value for each test you create
|
||||
|
||||
local @INC = @INC;
|
||||
unshift @INC, File::Spec->catdir( WebGUI::Test->getTestCollateralPath, 'Session-DateTime', 'lib' );
|
||||
|
|
@ -298,7 +298,13 @@ cmp_ok(
|
|||
|
||||
$dude->profileField('language', 'BadLocale');
|
||||
$session->user({user => $dude});
|
||||
is($dt->epochToHuman($wgbday), '8/16/2001 9:00 pm', 'epochToHuman: constructs a default locale if the language does not provide one.');
|
||||
is($dt->epochToHuman($wgbday), '8/16/2001 9:00 pm', 'epochToHuman: constructs a default locale if the language does not provide one.');
|
||||
$session->user({userId => 1});
|
||||
|
||||
##Variable digit days, months and hours
|
||||
is($dt->epochToHuman($wgbday,'%M'), '8', '... single digit month');
|
||||
my $dayEpoch = DateTime->from_epoch(epoch => $wgbday)->subtract(days => 10)->epoch;
|
||||
is($dt->epochToHuman($dayEpoch,'%D'), '6', '... single digit day');
|
||||
is($dt->epochToHuman($dayEpoch,'%H'), '8', '... single digit hour');
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue