Fix how logging gets intercepted. It used to be on by default, now it must be turned on.
This commit is contained in:
parent
78776f2f33
commit
06f52bae9a
6 changed files with 29 additions and 7 deletions
|
|
@ -451,6 +451,8 @@ cmp_bag(
|
|||
my $vTag2 = WebGUI::VersionTag->getWorking($session);
|
||||
$vTag2->set({name=>"deep addChild test"});
|
||||
|
||||
WebGUI::Test->interceptLogging();
|
||||
|
||||
my @deepAsset = ($root);
|
||||
|
||||
for (1..42) {
|
||||
|
|
|
|||
|
|
@ -116,6 +116,8 @@ $session->user({userId => 1}); ##back to Visitor
|
|||
my $wgBdayMail = 'Thu, 16 Aug 2001 08:00:00 -0500';
|
||||
is ($dt->mailToEpoch($wgBdayMail), $wgbday, 'mailToEpoch');
|
||||
|
||||
WebGUI::Test->interceptLogging();
|
||||
|
||||
is ($dt->mailToEpoch(750), undef, 'mailToEpoch returns undef on failure to parse');
|
||||
like($WebGUI::Test::logger_warns, qr{750 is not a valid date for email}, "DateTime logs a warning on failure to parse");
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ my ($eh) = $session->quick('errorHandler');
|
|||
#
|
||||
####################################################
|
||||
|
||||
WebGUI::Test->interceptLogging();
|
||||
|
||||
my $accumulated_warn = "";
|
||||
$eh->warn("This is a warning");
|
||||
is($WebGUI::Test::logger_warns, "This is a warning", "warn: Log4perl called");
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ is($stow->get("Test2"), undef, "deleteAll()");
|
|||
$session->config->set('disableCache', 1);
|
||||
is($stow->get('Test2'), undef, 'get: when config->disableCache is set get returns undef');
|
||||
|
||||
WebGUI::Test->interceptLogging();
|
||||
|
||||
$stow->set('unavailableVariable', 'too bad');
|
||||
is($WebGUI::Test::logger_debug, 'Stow->set() is being called but cache has been disabled', 'debug emitted by set when disableCache is true');
|
||||
|
||||
|
|
|
|||
|
|
@ -116,6 +116,9 @@ foreach my $extTest ( @{ $extensionTests } ) {
|
|||
# generateThumbnail
|
||||
#
|
||||
####################################################
|
||||
|
||||
WebGUI::Test->interceptLogging();
|
||||
|
||||
my $thumbStore = WebGUI::Storage::Image->create($session);
|
||||
my $square = WebGUI::Image->new($session, 500, 500);
|
||||
$square->setBackgroundColor('#FF0000');
|
||||
|
|
|
|||
|
|
@ -123,13 +123,6 @@ BEGIN {
|
|||
$SESSION = WebGUI::Session->open( $WEBGUI_ROOT, $CONFIG_FILE );
|
||||
$SESSION->{_request} = $pseudoRequest;
|
||||
|
||||
my $logger = $SESSION->errorHandler->getLogger;
|
||||
$logger = Test::MockObject::Extends->new( $logger );
|
||||
|
||||
$logger->mock( 'warn', sub { $WebGUI::Test::logger_warns = $_[1]} );
|
||||
$logger->mock( 'debug', sub { $WebGUI::Test::logger_debug = $_[1]} );
|
||||
$logger->mock( 'info', sub { $WebGUI::Test::logger_info = $_[1]} );
|
||||
$logger->mock( 'error', sub { $WebGUI::Test::logger_error = $_[1]} );
|
||||
}
|
||||
|
||||
END {
|
||||
|
|
@ -146,6 +139,24 @@ END {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 interceptLogging
|
||||
|
||||
Intercept logging request and capture them in buffer variables for testing
|
||||
|
||||
=cut
|
||||
|
||||
sub interceptLogging {
|
||||
my $logger = $SESSION->errorHandler->getLogger;
|
||||
$logger = Test::MockObject::Extends->new( $logger );
|
||||
|
||||
$logger->mock( 'warn', sub { $WebGUI::Test::logger_warns = $_[1]} );
|
||||
$logger->mock( 'debug', sub { $WebGUI::Test::logger_debug = $_[1]} );
|
||||
$logger->mock( 'info', sub { $WebGUI::Test::logger_info = $_[1]} );
|
||||
$logger->mock( 'error', sub { $WebGUI::Test::logger_error = $_[1]} );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 config
|
||||
|
||||
Returns the config object from the session.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue