Merge commit 'v7.10.15' into 8

Conflicts:
	docs/gotcha.txt
	docs/previousVersion.sql
	docs/templates.txt
	lib/WebGUI.pm
	lib/WebGUI/Asset.pm
	lib/WebGUI/Asset/Event.pm
	lib/WebGUI/Asset/File.pm
	lib/WebGUI/Asset/MapPoint.pm
	lib/WebGUI/Asset/RichEdit.pm
	lib/WebGUI/Asset/Sku/Product.pm
	lib/WebGUI/Asset/Snippet.pm
	lib/WebGUI/Asset/Story.pm
	lib/WebGUI/Asset/Template.pm
	lib/WebGUI/Asset/Template/TemplateToolkit.pm
	lib/WebGUI/Asset/Wobject/Calendar.pm
	lib/WebGUI/Asset/Wobject/Carousel.pm
	lib/WebGUI/Asset/Wobject/Collaboration.pm
	lib/WebGUI/Asset/Wobject/Dashboard.pm
	lib/WebGUI/Asset/Wobject/DataForm.pm
	lib/WebGUI/Asset/Wobject/Folder.pm
	lib/WebGUI/Asset/Wobject/Map.pm
	lib/WebGUI/Asset/Wobject/Search.pm
	lib/WebGUI/Asset/Wobject/Shelf.pm
	lib/WebGUI/Asset/Wobject/StockData.pm
	lib/WebGUI/Asset/Wobject/StoryTopic.pm
	lib/WebGUI/Asset/Wobject/SyndicatedContent.pm
	lib/WebGUI/Asset/Wobject/Thingy.pm
	lib/WebGUI/Asset/Wobject/WeatherData.pm
	lib/WebGUI/AssetClipboard.pm
	lib/WebGUI/AssetCollateral/DataForm/Entry.pm
	lib/WebGUI/AssetExportHtml.pm
	lib/WebGUI/AssetLineage.pm
	lib/WebGUI/AssetMetaData.pm
	lib/WebGUI/AssetTrash.pm
	lib/WebGUI/AssetVersioning.pm
	lib/WebGUI/Auth.pm
	lib/WebGUI/Cache/CHI.pm
	lib/WebGUI/Content/AssetManager.pm
	lib/WebGUI/Fork/ProgressBar.pm
	lib/WebGUI/Form/JsonTable.pm
	lib/WebGUI/Form/TimeField.pm
	lib/WebGUI/Form/Zipcode.pm
	lib/WebGUI/Group.pm
	lib/WebGUI/International.pm
	lib/WebGUI/Macro/AssetProxy.pm
	lib/WebGUI/Macro/FileUrl.pm
	lib/WebGUI/Operation/SSO.pm
	lib/WebGUI/Operation/User.pm
	lib/WebGUI/Role/Asset/Subscribable.pm
	lib/WebGUI/Shop/Cart.pm
	lib/WebGUI/Shop/Transaction.pm
	lib/WebGUI/Shop/TransactionItem.pm
	lib/WebGUI/Test.pm
	lib/WebGUI/URL/Content.pm
	lib/WebGUI/URL/Uploads.pm
	lib/WebGUI/User.pm
	lib/WebGUI/Workflow/Activity/ExtendCalendarRecurrences.pm
	lib/WebGUI/Workflow/Activity/SendNewsletters.pm
	lib/WebGUI/i18n/English/Asset.pm
	lib/WebGUI/i18n/English/WebGUI.pm
	sbin/installClass.pl
	sbin/rebuildLineage.pl
	sbin/search.pl
	sbin/testEnvironment.pl
	t/Asset/Asset.t
	t/Asset/AssetClipboard.t
	t/Asset/AssetLineage.t
	t/Asset/AssetMetaData.t
	t/Asset/Event.t
	t/Asset/File.t
	t/Asset/File/Image.t
	t/Asset/Post/notification.t
	t/Asset/Sku.t
	t/Asset/Story.t
	t/Asset/Template.t
	t/Asset/Wobject/Collaboration/templateVariables.t
	t/Asset/Wobject/Collaboration/unarchiveAll.t
	t/Asset/Wobject/Shelf.t
	t/Auth.t
	t/Macro/EditableToggle.t
	t/Macro/FilePump.t
	t/Shop/Cart.t
	t/Shop/Transaction.t
	t/Storage.t
	t/User.t
	t/Workflow.t
This commit is contained in:
Doug Bell 2011-05-13 18:15:11 -05:00
commit 277faae8a1
783 changed files with 32041 additions and 25495 deletions

View file

@ -48,7 +48,7 @@ my $testBlock = [
my $formType = 'date';
my $numTests = 27 + scalar @{ $testBlock } ;
my $numTests = 28 + scalar @{ $testBlock } ;
plan tests => $numTests;
@ -143,7 +143,7 @@ is(
$date2 = WebGUI::Form::Date->new($session, {defaultValue => '2008-008-001'});
is(
getValueFromForm($session, $date2->toHtml),
'1969-12-31',
'1970-01-01',
"toHtml: defaultValue in bad mysql format returns date from epoch 0"
);
@ -170,6 +170,12 @@ my $epochal_value = $date_form->getValue;
$date_form->set(value => $epochal_value);
my $mysql_date = getValueFromForm($session, $date_form->toHtml);
is $mysql_date, '2001-08-16', 'Form data processed and rendered round trip';
$session->request->setup_body({});
$session->user({userId => 1, });
my $day_form = WebGUI::Form::Date->new($session, { name => 'day_date', value=>'2001-08-16'});
my $day16 = getValueFromForm($session, $day_form->toHtml);
is $day16, '2001-08-16', 'day set correctly in form';
sub getValueFromForm {
my ($session, $textForm) = @_;

178
t/Form/Group.t Normal file
View file

@ -0,0 +1,178 @@
# 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::Group;
use WebGUI::Group;
use WebGUI::Session;
#The goal of this test is to verify that various www_ methods for the Group plugin work.
use Test::More;
use Test::Deep;
use JSON ();
use Data::Dumper;
my $session = WebGUI::Test->session;
# put your tests here
plan tests => 11;
my $groupAdminUser = WebGUI::User->new($session, 'new');
my $groupAdminGroup = WebGUI::Group->new($session, 'new');
$groupAdminGroup->addUsers([$groupAdminUser->userId]);
$session->setting->set('groupIdAdminGroup', $groupAdminGroup->getId);
WebGUI::Test->addToCleanup($groupAdminUser, $groupAdminGroup);
my $json;
$json = WebGUI::Form::Group::www_searchGroups($session);
is $json, '{"results":[]}', 'www_searchGroups: unprivileged user is not allowed to use this';
$session->user({user => $groupAdminUser});
$json = WebGUI::Form::Group::www_searchGroups($session);
is $json, '{"results":[]}', '... without a body parameter, returns valid empty JSON array';
$session->request->setup_body({query => 'Registered Users'});
$json = WebGUI::Form::Group::www_searchGroups($session);
my $group_data = JSON::from_json($json);
cmp_deeply(
$group_data,
{
results => [
{
groupId => 2,
groupName => 'Registered Users',
},
],
},
'... with an exact match, get one result back'
);
{
my @groups = map { my $group = WebGUI::Group->new($session, 'new'); $group->name('Test Group '. $_); $group; } 1..20;
my $cleanup = WebGUI::Test->cleanupGuard(@groups);
$session->request->setup_body({query => 'Test Group'});
$json = WebGUI::Form::Group::www_searchGroups($session);
my $group_data = JSON::from_json($json);
is scalar @{ $group_data->{results} }, 15, '... results are limited to 15';
}
{
my @groups = map { my $group = WebGUI::Group->new($session, 'new'); $group->name('Test Group '. $_); $group; } 1..5;
$groups[0]->showInForms(0);
my $cleanup = WebGUI::Test->cleanupGuard(@groups);
$session->request->setup_body({query => 'Test Group'});
$json = WebGUI::Form::Group::www_searchGroups($session);
my $group_data = JSON::from_json($json);
my $has_group0 = grep { $_->{groupName} eq $groups[0]->name } @{ $group_data->{results} };
ok ! $has_group0, '... group with showInForms set to false does not show up in the results';
}
my $test_group = WebGUI::Group->new($session, 'new');
$test_group->name('Testing Group');
my $andy = WebGUI::User->new($session, 'new');
$andy->username('andy');
my $red = WebGUI::User->new($session, 'new');
$red->username('red');
WebGUI::Test->addToCleanup($test_group, $andy, $red);
$session->request->setup_body({});
$session->user({userId => 1});
$json = WebGUI::Form::Group::www_groupMembers($session);
is $json, '{}', 'www_groupMembers: returns empty hashref for an unprivileged user';
$session->user({user => $groupAdminUser});
$json = WebGUI::Form::Group::www_groupMembers($session);
is $json, '{}', '... returns empty hashref if no form variable';
#1234567890123456789012
$session->request->setup_body({groupId => 'neverAWebGUIGroupId001'});
$json = WebGUI::Form::Group::www_groupMembers($session);
is $json, '{}', 'www_groupMembers: returns empty hashref if no groupId does not exist in the db';
$session->request->setup_body({groupId => $test_group->getId});
$json = WebGUI::Form::Group::www_groupMembers($session);
$group_data = JSON::from_json($json);
cmp_deeply(
$group_data,
{
groupName => 'Testing Group',
users => [ ],
groups => [
{
groupId => '3',
groupName => 'Admins',
},
],
},
'... with an exact match on an empty group, returns a hashref with arrayrefs'
);
$test_group->addUsers([$andy->getId]);
$json = WebGUI::Form::Group::www_groupMembers($session);
$group_data = JSON::from_json($json);
cmp_deeply(
$group_data,
{
groupName => 'Testing Group',
users => [
{
userId => $andy->userId,
username => 'andy',
}
],
groups => [
{
groupId => '3',
groupName => 'Admins',
},
],
},
'... with an exact match on a populated group, return users and groups'
);
$test_group->addGroups(['2']);
$json = WebGUI::Form::Group::www_groupMembers($session);
$group_data = JSON::from_json($json);
cmp_deeply(
$group_data,
{
groupName => 'Testing Group',
users => [
{
userId => $andy->userId,
username => 'andy',
}
],
groups => bag(
{
groupId => '2',
groupName => 'Registered Users',
},
{
groupId => '3',
groupName => 'Admins',
},
),
},
'... users not listed recursively, groups do not show up twice'
);

View file

@ -50,7 +50,7 @@ my $testBlock = [
my $formType = 'text'; ##timeField is a text subclass
my $numTests = 37 + scalar @{ $testBlock };
my $numTests = 40 + scalar @{ $testBlock };
plan tests => $numTests;
@ -71,11 +71,11 @@ my @forms = HTML::Form->parse($html, 'http://www.webgui.org');
is(scalar @forms, 1, '1 form was parsed');
my @inputs = $forms[0]->inputs;
is(scalar @inputs, 2, 'The form has 2 inputs. One for the field, another for the JS pop-up button.');
is(scalar @inputs, 2, 'The form has 2 inputs. Field and CSRF');
#Basic tests
my $input = $inputs[0];
my $input = $inputs[1];
is($input->name, 'TestTime', 'Checking input name');
is($input->type, $formType, 'Checking input type');
is($input->value, '00:00:10', 'Checking default value');
@ -86,48 +86,52 @@ WebGUI::Form_Checking::auto_check($session, 'TimeField', $testBlock);
my $cntl;
$cntl = WebGUI::Form::TimeField->new($session,{ });
is($cntl->getValue('10'), '10', 'no default, not mysql mode, all digits');
is($cntl->getValue('00:00:10'), '10', 'no default, not mysql mode, mysql formatted data, 3 pairs');
is($cntl->getValue('00:10'), '600', 'no default, not mysql mode, mysql formatted data, 2 pairs');
is($cntl->getValue('00:10:00'), '600', 'no default, not mysql mode, mysql formatted data, 3 pairs');
is($cntl->getValue('innocent'), undef, 'no default, not mysql mode, wrong data');
is($cntl->getValue('00:00:10'), '10', '... mysql formatted data, 3 pairs');
is($cntl->getValue('00:10'), '600', '... mysql formatted data, 2 pairs');
is($cntl->getValue('00:10:00'), '600', '... mysql formatted data, 3 pairs');
is($cntl->getValue('innocent'), undef, '... wrong data');
$cntl = WebGUI::Form::TimeField->new($session,{ format => 'mysql' });
is($cntl->getValue('10'), '00:00:10', 'no default, mysql mode, all digits');
is($cntl->getValue('00:00:10'), '00:00:10', 'no default, mysql mode, mysql formatted data, 3 pairs');
is($cntl->getValue('00:10'), '00:10', 'no default, mysql mode, mysql formatted data, 2 pairs');
is($cntl->getValue('00:10:00'), '00:10:00', 'no default, mysql mode, mysql formatted data, 3 pairs');
is($cntl->getValue('innocent'), undef, 'no default, mysql mode, wrong data');
is($cntl->getValue('00:00:10'), '00:00:10', '... mysql formatted data, 3 pairs');
is($cntl->getValue('00:10'), '00:10', '... mysql formatted data, 2 pairs');
is($cntl->getValue('00:10:00'), '00:10:00', '... mysql formatted data, 3 pairs');
is($cntl->getValue('innocent'), undef, '... wrong data');
$cntl = WebGUI::Form::TimeField->new($session,{ defaultValue => 0, });
is($cntl->getValue('10'), '10', '0 default, not mysql mode, all digits');
is($cntl->getValue('00:00:10'), '10', '0 default, not mysql mode, mysql formatted data, 3 pairs');
is($cntl->getValue('00:10'), '600', '0 default, not mysql mode, mysql formatted data, 2 pairs');
is($cntl->getValue('00:10:00'), '600', '0 default, not mysql mode, mysql formatted data, 3 pairs');
is($cntl->getValue('00:00:10'), '10', '... mysql formatted data, 3 pairs');
is($cntl->getValue('00:10'), '600', '... mysql formatted data, 2 pairs');
is($cntl->getValue('00:10:00'), '600', '... mysql formatted data, 3 pairs');
$cntl = WebGUI::Form::TimeField->new($session,{ defaultValue => 1, });
is($cntl->getValue('10'), '10', '1 default, not mysql mode, all digits');
is($cntl->getValue('00:00:10'), '10', '1 default, not mysql mode, mysql formatted data, 3 pairs');
is($cntl->getValue('00:10'), '600', '1 default, not mysql mode, mysql formatted data, 2 pairs');
is($cntl->getValue('00:10:00'), '600', '1 default, not mysql mode, mysql formatted data, 3 pairs');
is($cntl->getValue('00:00:10'), '10', '... mysql formatted data, 3 pairs');
is($cntl->getValue('00:10'), '600', '... mysql formatted data, 2 pairs');
is($cntl->getValue('00:10:00'), '600', '... mysql formatted data, 3 pairs');
$cntl = WebGUI::Form::TimeField->new($session,{ defaultValue => '55:55:55', });
is($cntl->getValue('10'), '00:00:10', 'mysql defaultValue, all digits');
is($cntl->getValue('00:00:10'), '00:00:10', 'mysql defaultValue, mysql formatted data, 3 pairs');
is($cntl->getValue('00:10'), '00:10', 'mysql defaultValue, mysql formatted data, 2 pairs');
is($cntl->getValue('00:10:00'), '00:10:00', 'mysql defaultValue, mysql formatted data, 3 pairs');
is($cntl->getValue('00:00:10'), '00:00:10', '... mysql formatted data, 3 pairs');
is($cntl->getValue('00:10'), '00:10', '... mysql formatted data, 2 pairs');
is($cntl->getValue('00:10:00'), '00:10:00', '... mysql formatted data, 3 pairs');
$cntl = WebGUI::Form::TimeField->new($session,{ defaultValue => 0, format => 'mysql', });
is($cntl->getValue('10'), '00:00:10', '0 default, mysql mode, all digits');
is($cntl->getValue('00:00:10'), '00:00:10', '0 default, mysql mode, mysql formatted data, 3 pairs');
is($cntl->getValue('00:10'), '00:10', '0 default, mysql mode, mysql formatted data, 2 pairs');
is($cntl->getValue('00:10:00'), '00:10:00', '0 default, mysql mode, mysql formatted data, 3 pairs');
is($cntl->getValue('high noon'), undef, '0 default, mysql mode, mysql formatted data, bad data');
is($cntl->getValue('00:00:10'), '00:00:10', '... mysql formatted data, 3 pairs');
is($cntl->getValue('00:10'), '00:10', '... mysql formatted data, 2 pairs');
is($cntl->getValue('00:10:00'), '00:10:00', '... mysql formatted data, 3 pairs');
is($cntl->getValue('high noon'), undef, '... mysql formatted data, bad data');
$cntl = WebGUI::Form::TimeField->new($session,{ defaultValue => 1, format => 'mysql', });
is($cntl->getValue('10'), '00:00:10', '1 default, mysql mode, all digits');
is($cntl->getValue('00:00:10'), '00:00:10', '1 default, mysql mode, mysql formatted data, 3 pairs');
is($cntl->getValue('00:10'), '00:10', '1 default, mysql mode, mysql formatted data, 2 pairs');
is($cntl->getValue('00:10:00'), '00:10:00', '1 default, mysql mode, mysql formatted data, 3 pairs');
__END__
is($cntl->getValue('00:00:10'), '00:00:10', '... mysql formatted data, 3 pairs');
is($cntl->getValue('00:10'), '00:10', '... mysql formatted data, 2 pairs');
is($cntl->getValue('00:10:00'), '00:10:00', '... mysql formatted data, 3 pairs');
$cntl->set('value', 10);
is($cntl->getValueAsHtml('10'), '00:00:10', 'getValueAsHtml, all digits');
$cntl->set('value', '00:10');
is($cntl->getValueAsHtml('00:10'), '00:10', '... minutes');
$cntl->set('value', '00:10:00');
is($cntl->getValueAsHtml('00:10:00'), '00:10:00', 'minutes, with empty seconds');

74
t/Form/User.t Normal file
View file

@ -0,0 +1,74 @@
# 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::User;
use WebGUI::Group;
use WebGUI::Session;
#The goal of this test is to verify that various www_ methods for the Group plugin work.
use Test::More;
use Test::Deep;
use JSON ();
use Data::Dumper;
my $session = WebGUI::Test->session;
# put your tests here
plan tests => 4;
my $userAdminUser = WebGUI::User->new($session, 'new');
my $userAdminGroup = WebGUI::Group->new($session, 'new');
$userAdminGroup->addUsers([$userAdminUser->userId]);
$session->setting->set('groupIdAdminUser', $userAdminGroup->getId);
WebGUI::Test->addToCleanup($userAdminUser, $userAdminGroup);
my $json;
$json = WebGUI::Form::User::www_searchUsers($session);
is $json, '{"results":[]}', 'www_searchUsers: unprivileged user is not allowed to use this';
$session->user({user => $userAdminUser});
$json = WebGUI::Form::User::www_searchUsers($session);
is $json, '{"results":[]}', '... without a body parameter, returns valid empty JSON array';
$session->request->setup_body({query => 'Visitor'});
$json = WebGUI::Form::User::www_searchUsers($session);
my $group_data = JSON::from_json($json);
cmp_deeply(
$group_data,
{
results => [
{
userId => 1,
username => 'Visitor',
},
],
},
'... with an exact match, get one result back'
);
{
my @users = map { my $user = WebGUI::User->new($session, 'new'); $user->username('Test User '. $_); $user; } 1..20;
my $cleanup = WebGUI::Test->cleanupGuard(@users);
$session->request->setup_body({query => 'Test User'});
$json = WebGUI::Form::User::www_searchUsers($session);
my $group_data = JSON::from_json($json);
is scalar @{ $group_data->{results} }, 15, '... results are limited to 15';
}