Change caching on the SQLReport to be set by its cacheTimeout, even
when viewed standalone, and not part of a page.
This commit is contained in:
parent
ff61666ead
commit
20a333cde8
3 changed files with 86 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
- fixed: Reverted bugfix for 10409 and changed the hover help to reflect the correct way to build list-type form controls in the MetaData.
|
||||
- fixed: Template parser cannot be set
|
||||
- fixed #10361: Shortcuts duplicate extra header tags
|
||||
- fixed #10356: SQL report is cached too long
|
||||
|
||||
7.7.8
|
||||
- fixed: Basic Auth doesn't work if password contains colon (Arjan Widlak,
|
||||
|
|
|
|||
|
|
@ -221,6 +221,20 @@ sub definition {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getContentLastModified ( )
|
||||
|
||||
Override the base method, since SQL Report content can change without the asset being
|
||||
touched. Default to using $self->get('cacheTimeout') seconds ago.
|
||||
|
||||
=cut
|
||||
|
||||
sub getContentLastModified {
|
||||
my $self = shift;
|
||||
return (time - $self->get("cacheTimeout"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getEditForm ( )
|
||||
|
||||
Manually make the edit form due to javascript for adding more queries.
|
||||
|
|
|
|||
71
t/Asset/Wobject/SQLReport.t
Normal file
71
t/Asset/Wobject/SQLReport.t
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
# vim:syntax=perl
|
||||
#-------------------------------------------------------------------
|
||||
# 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
|
||||
#------------------------------------------------------------------
|
||||
|
||||
# Write a little about what this script tests.
|
||||
#
|
||||
#
|
||||
|
||||
use FindBin;
|
||||
use strict;
|
||||
use lib "$FindBin::Bin/../../lib";
|
||||
use Test::More;
|
||||
use Test::Deep;
|
||||
use Data::Dumper;
|
||||
|
||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||
use WebGUI::Session;
|
||||
|
||||
################################################################
|
||||
#
|
||||
# setup session, users and groups for this test
|
||||
#
|
||||
################################################################
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $tests = 4
|
||||
;
|
||||
plan tests => 1
|
||||
+ $tests;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# put your tests here
|
||||
|
||||
my $class = 'WebGUI::Asset::Wobject::SQLReport';
|
||||
my $loaded = use_ok($class);
|
||||
|
||||
SKIP: {
|
||||
|
||||
skip "Unable to load module $class", $tests unless $loaded;
|
||||
|
||||
|
||||
my $defaultNode = WebGUI::Asset->getDefault($session);
|
||||
|
||||
my $report = $defaultNode->addChild({
|
||||
className => $class,
|
||||
title => 'test report',
|
||||
cacheTimeout => 50,
|
||||
dqQuery1 => 'select * from users',
|
||||
});
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->tagsToRollback($versionTag);
|
||||
$versionTag->commit;
|
||||
|
||||
isa_ok($report, 'WebGUI::Asset::Wobject::SQLReport');
|
||||
|
||||
is($report->get('cacheTimeout'), 50, 'cacheTimeout set correctly');
|
||||
ok(abs($report->getContentLastModified - (time - 50)) < 2, 'getContentLastModified overridden correctly');
|
||||
|
||||
$report->update({cacheTimeout => 250});
|
||||
ok(abs($report->getContentLastModified - (time - 250)) < 2, '... tracks cacheTimeout');
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue