Merge commit 'v7.10.24' into WebGUI8

This commit is contained in:
Colin Kuskie 2012-01-17 15:03:45 -08:00
commit 3b418ede3c
139 changed files with 699 additions and 32133 deletions

View file

@ -55,8 +55,6 @@ use Data::Dumper;
use WebGUI::Asset::Wobject::Calendar;
use WebGUI::Asset::Event;
plan tests => 14 + scalar @icalWrapTests;
my $session = WebGUI::Test->session;
# Do our work in the import node
@ -553,6 +551,9 @@ cmp_deeply(
'... correct set of events in list view'
);
ok(exists $listVars->{events}->[0]->{new_year} && $listVars->{events}->[0]->{new_year}, 'first event has new_year set');
ok(exists $listVars->{events}->[0]->{new_month} && $listVars->{events}->[0]->{new_month}, 'first event has new_month set');
ok(exists $listVars->{events}->[0]->{new_day} && $listVars->{events}->[0]->{new_day}, 'first event has new_day set');
######################################################################
#
@ -580,3 +581,5 @@ cmp_deeply(
[],
'but getFeeds still returns a data structure.'
);
done_testing;

View file

@ -0,0 +1,67 @@
# Tests WebGUI::Asset::Wobject::Survey Reporting
#
#
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../../../lib";
use Test::More;
use Test::Deep;
use Data::Dumper;
use Clone qw/clone/;
use WebGUI::Test; # Must use this before any other WebGUI modules
use WebGUI::Session;
WebGUI::Error->Trace(1); # Turn on tracing of uncaught Exception::Class exceptions
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# put your tests here
my $import_node = WebGUI::Asset->getImportNode($session);
# Create a Survey
my $survey = $import_node->addChild( { className => 'WebGUI::Asset::Wobject::Survey', } );
WebGUI::Test->addToCleanup($survey);
my $sJSON = $survey->surveyJSON;
# Load bare-bones survey, containing a single section (S0)
$sJSON->update([0], { variable => 'S0' });
# Add 1 question to S0
$sJSON->newObject([0]); # S0Q0
$sJSON->update([0,0], { variable => 'toes', questionType => 'Multiple Choice' });
$sJSON->update([0,0,0], { text => 'one',});
$sJSON->update([0,0,1], { text => 'two',});
$sJSON->update([0,0,2], { text => 'more than two',});
$sJSON->update([0,1], { variable => 'name', questionType => 'Text' });
$survey->addType('toes', [0,0]);
$survey->persistSurveyJSON; ##This does not update the SurveyJSON object cacched in the Survey object
$survey=$survey->cloneFromDb;
my $asset_data = $survey->exportAssetData();
ok exists $asset_data->{question_types}, 'question_types entry exists in asset data to package';
ok exists $asset_data->{question_types}->{toes}, 'the toes type in a question type' or
explain $asset_data;
ok !exists $asset_data->{question_types}->{name}, 'name question not in question types';
$asset_data->{question_types}->{fingers} = clone $asset_data->{question_types}->{toes};
$survey->importAssetCollateralData($asset_data);
$survey = $survey->cloneFromDb;
my $multipleChoiceTypes = $survey->surveyJSON->multipleChoiceTypes;
ok exists $multipleChoiceTypes->{fingers}, 'fingers type imported as package collateral data';
ok exists $multipleChoiceTypes->{toes}, 'still have toes, too';
done_testing();
#vim:ft=perl