Merge commit 'v7.10.24' into WebGUI8
This commit is contained in:
commit
3b418ede3c
139 changed files with 699 additions and 32133 deletions
|
|
@ -428,7 +428,7 @@ my $expected = {
|
|||
},
|
||||
'description' => undef,
|
||||
'_isValid' => 1,
|
||||
'deleteCreatedItems' => '0',
|
||||
'deleteCreatedItems' => 0,
|
||||
'canSubmitGroupId' => '2',
|
||||
'assetId' => 'new',
|
||||
'url' => '',
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ use WebGUI::Test;
|
|||
use WebGUI::Session;
|
||||
use WebGUI::Asset::Template;
|
||||
use Exception::Class;
|
||||
|
||||
use Test::More tests => 62; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
use Data::Dumper;
|
||||
use Test::Exception;
|
||||
|
|
@ -344,4 +342,16 @@ throws_ok
|
|||
'Parser not in config dies';
|
||||
isa_ok $class->getParser( $session, 'WebGUI::Asset::Template::HTMLTemplateExpr'), 'WebGUI::Asset::Template::HTMLTemplateExpr', 'parser in config is created';
|
||||
|
||||
{
|
||||
use Test::MockObject::Extends;
|
||||
my $mockparser = Test::MockObject->new->mock( process => sub { $@ = "failed" } );
|
||||
my $mockTemplate = Test::MockObject::Extends->new( $class )
|
||||
->mock( get => sub { return '' } )
|
||||
->mock( session => sub { return $session } )
|
||||
->mock( getParser => sub { return $mockparser } )
|
||||
;
|
||||
is $mockTemplate->process, 'failed', 'handle non-reference exceeption';
|
||||
}
|
||||
|
||||
done_testing;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
67
t/Asset/Wobject/Survey/package.t
Normal file
67
t/Asset/Wobject/Survey/package.t
Normal 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
|
||||
|
|
@ -33,7 +33,7 @@ $env->{'QUERY_STRING'} = 'func=search';
|
|||
|
||||
my $i18n = WebGUI::International->new($session,'Macro_L_loginBox');
|
||||
|
||||
plan tests => 30;
|
||||
plan tests => 31;
|
||||
|
||||
my $output = WebGUI::Macro::L_loginBox::process($session,'','',$template->getId);
|
||||
my %vars = simpleTextParser($output);
|
||||
|
|
@ -150,6 +150,12 @@ $output = WebGUI::Macro::L_loginBox::process($session,'','',$template->getId);
|
|||
%vars = simpleTextParser($output);
|
||||
like($vars{'form.header'}, qr{https://}, 'form.header action set to use SSL by encryptLogin');
|
||||
|
||||
WebGUI::Test->originalConfig('webServerPort');
|
||||
$session->config->set('webServerPort', 8081);
|
||||
$output = WebGUI::Macro::L_loginBox::process($session,'','',$template->getId);
|
||||
%vars = simpleTextParser($output);
|
||||
unlike($vars{'form.header'}, qr{:8081}, '... when setting, remove the port');
|
||||
|
||||
##Finally, a test that the default Template exists
|
||||
|
||||
$output = WebGUI::Macro::L_loginBox::process($session,'','','');
|
||||
|
|
|
|||
|
|
@ -3,20 +3,22 @@ use strict;
|
|||
#use DB;
|
||||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::PassiveAnalytics::Rule;
|
||||
use WebGUI::Workflow::Activity::BucketPassiveAnalytics;
|
||||
use WebGUI::Text;
|
||||
|
||||
use Test::More;
|
||||
use Test::Deep;
|
||||
use Data::Dumper;
|
||||
|
||||
plan tests => 1; # increment this value for each test you create
|
||||
plan tests => 2; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
$session->user({userId => 3});
|
||||
|
||||
WebGUI::Test->addToCleanup(SQL => 'delete from passiveLog');
|
||||
WebGUI::Test->addToCleanup(SQL => 'delete from deltaLog');
|
||||
WebGUI::Test->addToCleanup(SQL => 'delete from bucketLog');
|
||||
WebGUI::Test->addToCleanup(SQL => 'delete from analyticRule');
|
||||
WebGUI::Test->addToCleanup(SQL => 'delete from PA_lastLog');
|
||||
|
||||
my $workflow = WebGUI::Workflow->new($session, 'PassiveAnalytics000001');
|
||||
my $activities = $workflow->getActivities();
|
||||
|
|
@ -63,7 +65,8 @@ while (my $spec = shift @url2) {
|
|||
}
|
||||
|
||||
my @urls = map {$_->[1]} @ruleSets;
|
||||
loadLogData($session, @urls);
|
||||
#loadLogData($session, @urls);
|
||||
repeatableLogData($session, 'passiveAnalyticsLog');
|
||||
|
||||
##Build rulesets
|
||||
|
||||
|
|
@ -76,7 +79,28 @@ PAUSE: while (my $retval = $instance->run()) {
|
|||
}
|
||||
#DB::disable_profile();
|
||||
|
||||
ok(1, 'One test');
|
||||
cmp_ok $counter, '<', 16, 'Successful completion of PA';
|
||||
|
||||
my $get_line = $session->db->read('select userId, Bucket, duration from bucketLog');
|
||||
|
||||
my @database_dump = ();
|
||||
ROW: while ( 1 ) {
|
||||
my @datum = $get_line->array();
|
||||
last ROW unless @datum;
|
||||
push @database_dump, [ @datum ];
|
||||
}
|
||||
|
||||
cmp_bag(
|
||||
[ @database_dump ],
|
||||
[
|
||||
['user1', 'one', 10],
|
||||
['user1', 'two', 15],
|
||||
['user2', 'zero', 2],
|
||||
['user2', 'uno', 3],
|
||||
['user2', 'Other', 5],
|
||||
],
|
||||
'PA analysis completed, and calculated correctly'
|
||||
) or diag Dumper(\@database_dump);
|
||||
|
||||
sub loadLogData {
|
||||
my ($session, @urls) = @_;
|
||||
|
|
@ -96,4 +120,24 @@ sub loadLogData {
|
|||
}
|
||||
}
|
||||
|
||||
sub repeatableLogData {
|
||||
my ($session, $dataLogName) = @_;
|
||||
$session->db->write('delete from passiveLog');
|
||||
my $insert = $session->db->prepare(
|
||||
q!insert into passiveLog (userId, sessionId, timeStamp, url, assetId) VALUES (?,?,?,?,'assetId')!
|
||||
);
|
||||
my $data_name = WebGUI::Test::collateral('passiveAnalyticsLog');
|
||||
open my $log_data, '<', $data_name or
|
||||
die "Unable to open $data_name for reading: $!";
|
||||
local $_;
|
||||
while (<$log_data>) {
|
||||
next if /^\s*#/;
|
||||
s/#\.*$//;
|
||||
chomp;
|
||||
my @data = split;
|
||||
$insert->execute([@data]);
|
||||
}
|
||||
$insert->finish;
|
||||
}
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ $retVal = $instance1->run();
|
|||
is($retVal, 'complete', 'cleanup: activity complete');
|
||||
$retVal = $instance1->run();
|
||||
is($retVal, 'done', 'cleanup: activity is done');
|
||||
$instance1->delete;
|
||||
$instance1->delete('skipNotify');
|
||||
|
||||
my $origSessionTimeout = $session->setting->get('sessionTimeout');
|
||||
|
||||
|
|
@ -77,6 +77,7 @@ my $instance2 = WebGUI::Workflow::Instance->create($session,
|
|||
skipSpectreNotification => 1,
|
||||
}
|
||||
);
|
||||
WebGUI::Test->addToCleanup($instance2);
|
||||
|
||||
my $counter = 0;
|
||||
PAUSE: while ($retVal = $instance2->run()) {
|
||||
|
|
|
|||
9
t/supporting_collateral/passiveAnalyticsLog
Normal file
9
t/supporting_collateral/passiveAnalyticsLog
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#user session timestamp url
|
||||
user1 session11 100 /one
|
||||
user1 session11 110 /two
|
||||
user1 session11 125 /three
|
||||
user2 session21 200 /yelnats
|
||||
user2 session21 202 /one/uno
|
||||
user2 session21 205 /whatever
|
||||
user2 session21 210 /something_else
|
||||
user2 session21 610 /something_else
|
||||
Loading…
Add table
Add a link
Reference in a new issue