use callback for log interception instead of on/off

This commit is contained in:
Graham Knop 2010-06-17 09:18:50 -05:00
parent 8bfa022441
commit 18525e7c1b
9 changed files with 126 additions and 268 deletions

View file

@ -120,10 +120,12 @@ $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();
WebGUI::Test->interceptLogging( sub {
my $log_data = shift;
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");
is ($dt->mailToEpoch(750), undef, 'mailToEpoch returns undef on failure to parse');
like($log_data->{warn}, qr{750 is not a valid date for email}, "DateTime logs a warning on failure to parse");
});
####################################################
#