various changes

This commit is contained in:
daviddelikat 2009-10-03 11:19:50 -05:00
parent 5f3477be4a
commit 209732287e
6 changed files with 140 additions and 40 deletions

View file

@ -15,11 +15,12 @@
use FindBin;
use strict;
use lib "$FindBin::Bin/lib";
use lib "$FindBin::Bin/../lib";
use Test::More;
use WebGUI::Group;
use WebGUI::User;
use WebGUI::Test; # Must use this before any other WebGUI modules
use WebGUI::Test::Activity;
use WebGUI::Session;
use WebGUI::Asset::Wobject::EventManagementSystem;
use WebGUI::Asset::Sku::EMSBadge;
@ -34,7 +35,7 @@ my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
plan tests => 1; # Increment this number for each test you create
plan tests => 200; # Increment this number for each test you create
my $submitGroupA = WebGUI::Group->new($session,'new');
my $submitGroupB = WebGUI::Group->new($session,'new');
@ -65,14 +66,18 @@ sub logout { $session->user({userId => 1}); }
#----------------------------------------------------------------------------
# put your tests here
use_ok WebGUI::Asset::EMSSubmissionForm;
use_ok WebGUI::Asset::EMSSubmission;
use_ok 'WebGUI::Asset::EMSSubmissionForm';
use_ok 'WebGUI::Asset::EMSSubmission';
loginAdmin;
# Create a version tag to work in
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"EventManagementSystem Test"});
WebGUI::Test->tagsToRollback($versionTag);
# Do our work in the import node
my $node = WebGUI::Asset->getImportNode($session);
# Add an EMS asset
my $ems = $node->addChild({
@ -84,44 +89,107 @@ my $ems = $node->addChild({
registrationStaffGroupId => $registrars->getId,
groupIdView => $attendees->getId
});
# I scooped this out ot WG::Asset::Wobject::EventManagementSystem
# its not pretty, but there is no other way to add a meta field
$ems->setCollateral("EMSEventMetaField", "fieldId",{
fieldId=> 'new',
label => 'metaField1',
dataType => 'Url',
visible => 1,
required => 1,
possibleValues => '',
defaultValues => '',
},1,1);
$ems->setCollateral("EMSEventMetaField", "fieldId",{
fieldId=> 'new',
label => 'metaField2',
dataType => 'Date',
visible => 1,
required => 0,
possibleValues => '',
defaultValues => '',
},1,1);
$versionTag->commit;
WebGUI::Test->tagsToRollback($versionTag);
$versionTag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->tagsToRollback($versionTag);
loginRgstr;
my $frmA = $ems->addChild({
className => 'WebGUI::Asset::EMSSubmissionForm',
title => 'test A -- long',
canSubmitGroup => $submitGroupA->getId,
formDescription => q{
TODO = 1
},
});
isa( $frmA, 'WebGUI::Asset::EMSSubmissionForm' );
isa_ok( $frmA, 'WebGUI::Asset::EMSSubmissionForm' );
ok( $frmA->validateSubmission({
TODO => 1
}), 'a valid submission' );
ok( !$frmA->validateSubmission({
TODO => 1
}), 'not a valid submission' );
# TODO: test more field validations
# TODO use meta field in this form
my $frmB = $ems->addChild({
className => 'WebGUI::Asset::EMSSubmissionForm',
title => 'test B -- short',
canSubmitGroup => $submitGroupB->getId,
formDescription => q{
TODO = 1
},
});
# TODO: test meta field validation
loginUserA;
# this one should work
my $sub1 = $frmA->addSubmission({
title => 'my favorite thing to talk about',
});
#this one should fail
my $sub2 = $frmB->addSubmission({
title => 'why i like to be important',
});
loginUserB;
# should work
my $sub3 = $frmB->addSubmission({
title => 'five minutes of me',
});
loginUserC;
# should work
my $sub4 = $frmB->addSubmission({
title => 'why humility is underrated',
});
# should work
my $sub5 = $frmA->addSubmission({
title => 'what you should know about everybody',
});
$sub1->addComment({ 'this is a test comment' });
my $TODO = q{
create submission(s)
comment on submission(s)
modify submission(s)
change submission status
run submission approval activity
run submission cleanup activity
}
};
$versionTag->commit;
WebGUI::Test->tagsToRollback($versionTag);
#----------------------------------------------------------------------------
# Cleanup
END {
# everything should be entered into the WG::Test cleanup lists...
}
#vim:ft=perl