More explicit explanations
This commit is contained in:
parent
a5f786c986
commit
a7fee58aad
@ -119,8 +119,22 @@ sub run_plugin_tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub fake_hook {
|
sub fake_hook {
|
||||||
# Used to test core code against different potential plugins
|
###########################################################################
|
||||||
# it will interact with
|
# Inserts a given subroutine into the beginning of the set of hooks already
|
||||||
|
# in place. Used to test code against different potential plugins it will
|
||||||
|
# interact with. For example, to test behavior against various results of
|
||||||
|
# the data_post hook:
|
||||||
|
#
|
||||||
|
# $self->fake_hook('data_post',sub { return DECLINED };
|
||||||
|
# ok(...);
|
||||||
|
# $self->fake_hook('data_post',sub { return DENYSOFT };
|
||||||
|
# ok(...);
|
||||||
|
# $self->fake_hook('data_post',sub { return DENY };
|
||||||
|
# ok(...);
|
||||||
|
# $self->fake_hook('data_post',sub { return DENY_DISCONNECT };
|
||||||
|
# ok(...);
|
||||||
|
# $self->unfake_hook('data_post');
|
||||||
|
###########################################################################
|
||||||
my ( $self, $hook, $sub ) = @_;
|
my ( $self, $hook, $sub ) = @_;
|
||||||
unshift @{ $self->hooks->{$hook} ||= [] },
|
unshift @{ $self->hooks->{$hook} ||= [] },
|
||||||
{
|
{
|
||||||
@ -138,7 +152,18 @@ sub unfake_hook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub fake_config {
|
sub fake_config {
|
||||||
|
####################################################################
|
||||||
# Used to test code against various possible configurations
|
# Used to test code against various possible configurations
|
||||||
|
# For example, to test against various possible config('me') values:
|
||||||
|
#
|
||||||
|
# $self->fake_config( me => '***invalid***' );
|
||||||
|
# ok(...);
|
||||||
|
# $self->fake_config( me => 'valid-nonfqdn' );
|
||||||
|
# ok(...);
|
||||||
|
# $self->fake_config( me => 'valid-fqdn.com');
|
||||||
|
# ok(...);
|
||||||
|
# $self->unfake_config();
|
||||||
|
####################################################################
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $fake_config = {@_};
|
my $fake_config = {@_};
|
||||||
$self->fake_hook( 'config',
|
$self->fake_hook( 'config',
|
||||||
|
Loading…
Reference in New Issue
Block a user