From a11eab6da9349ec24c96027122670fd3705ac2ce Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Mon, 5 Jun 2017 18:18:07 -0400 Subject: [PATCH] [SIGNED-OFF] Bug 18732: Noisy t/SMS.t triggered by koha_conf.xml without sms_send_config Upgraded systems may be lacking sms_send_config which makes t/SMS.t noisy. This tweaks the tests to compensate and change for missing case. Remove sms_send_config from your koha-conf.xml file prove t/SMS.t -- it will be noisy, but pass. apply patch prove t/SMS.t -- noise gone, test added run koha qa test tools. Signed-off-by: Josef Moravec --- C4/SMS.pm | 4 ++++ t/SMS.t | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/C4/SMS.pm b/C4/SMS.pm index c603117..e623e6c 100644 --- a/C4/SMS.pm +++ b/C4/SMS.pm @@ -89,6 +89,10 @@ sub send_sms { my $driver = exists $params->{'driver'} ? $params->{'driver'} : $self->driver(); return unless $driver; + if ( ! defined C4::Context->config('sms_send_config') ) { + # Should I warn in some way? + return; + } my ($sent, $sender); diff --git a/t/SMS.t b/t/SMS.t index fca44b4..4b6c535 100755 --- a/t/SMS.t +++ b/t/SMS.t @@ -19,7 +19,7 @@ use Modern::Perl; use t::lib::Mocks; -use Test::More tests => 7; +use Test::More tests => 8; BEGIN { use_ok('C4::SMS'); @@ -53,6 +53,15 @@ $send_sms = C4::SMS->send_sms({ }); is( $send_sms, undef, 'send_sms with an undef driver returns undef' ); +t::lib::Mocks::mock_config('sms_send_config',undef); +$send_sms = C4::SMS->send_sms({ + destination => '+33123456789', + message => 'my message', + driver => 'Test', +}); +is( $send_sms, undef, 'send_sms without sms_send_config defined returns undef' ); + +t::lib::Mocks::mock_config('sms_send_config','\tmp'); $send_sms = C4::SMS->send_sms({ destination => '+33123456789', message => 'my message', -- 2.1.4