diff --git a/C4/SMS.pm b/C4/SMS.pm index 959e407c8d..19f1d852d7 100644 --- a/C4/SMS.pm +++ b/C4/SMS.pm @@ -34,7 +34,6 @@ use strict; use warnings; use C4::Context; -use SMS::Send; use vars qw( $VERSION ); @@ -67,6 +66,12 @@ sub send_sms { return unless defined $params->{ $required_parameter }; } + eval { require SMS::Send; }; + if ( $@ ) { + # we apparently don't have SMS::Send. Return a failure. + return; + } + # This allows the user to override the driver. See SMS::Send::Test my $driver = exists $params->{'driver'} ? $params->{'driver'} : $self->driver(); return unless $driver; diff --git a/t/lib/KohaTest/SMS/send_sms.pm b/t/lib/KohaTest/SMS/send_sms.pm index c23c47f74b..d6bbb64c5b 100644 --- a/t/lib/KohaTest/SMS/send_sms.pm +++ b/t/lib/KohaTest/SMS/send_sms.pm @@ -10,7 +10,7 @@ use C4::SMS; sub testing_class { 'C4::SMS' }; -sub send_a_message : Test( 2 ) { +sub send_a_message : Test( 1 ) { my $self = shift; my $success = C4::SMS->send_sms( { destination => '+1 212-555-1111',