Test content_log enable/disable logic
This commit is contained in:
parent
ae887c156b
commit
edc8f7600d
@ -6,10 +6,8 @@
|
||||
use POSIX qw:strftime:;
|
||||
|
||||
sub register {
|
||||
my ( $self, $qp ) = @_;
|
||||
my $enabled = $qp->config('enable_content_log');
|
||||
$enabled = 'true' if ! defined $enabled;
|
||||
return if lc($enabled) ne 'true';
|
||||
my ( $self ) = @_;
|
||||
return if ! $self->content_log_enabled;
|
||||
$self->register_hook('data_post', 'data_post_handler');
|
||||
}
|
||||
|
||||
@ -35,3 +33,11 @@ sub content_log_file {
|
||||
my $date = strftime("%Y%m%d", localtime(time));
|
||||
return "mail/$date";
|
||||
}
|
||||
|
||||
sub content_log_enabled {
|
||||
my ( $self ) = @_;
|
||||
my $enabled = $self->qp->config('enable_content_log');
|
||||
$enabled = 'true' if ! defined $enabled;
|
||||
return 1 if lc($enabled) eq 'true';
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ use warnings;
|
||||
|
||||
sub register_tests {
|
||||
my ( $self ) = @_;
|
||||
|
||||
$self->register_test('test_content_log_file');
|
||||
$self->register_test('test_content_log_enabled');
|
||||
}
|
||||
|
||||
sub test_content_log_file {
|
||||
@ -14,3 +14,8 @@ sub test_content_log_file {
|
||||
ok( $self->content_log_file, 'content_log_file() returns something' );
|
||||
}
|
||||
|
||||
sub test_content_log_enabled {
|
||||
my ( $self ) = @_;
|
||||
ok( ! $self->content_log_enabled, 'content_log_enabled() returns false' );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user