Switch from redefine to mock

This commit is contained in:
Richard Hansen 2020-07-08 15:49:31 -04:00
parent 173865bd75
commit bba1ecfe27

View file

@ -8,7 +8,9 @@ eval { require 'ddclient'; } or BAIL_OUT($@);
my $warning; my $warning;
my $module = Test::MockModule->new('ddclient'); my $module = Test::MockModule->new('ddclient');
$module->redefine('warning', sub { # Note: 'mock' is used instead of 'redefine' because 'redefine' is not available in the versions of
# Test::MockModule distributed with old Debian and Ubuntu releases.
$module->mock('warning', sub {
BAIL_OUT("warning already logged") if defined($warning); BAIL_OUT("warning already logged") if defined($warning);
$warning = sprintf(shift, @_); $warning = sprintf(shift, @_);
}); });