I wrapped the use of the SMS::Send module in an eval to make failures graceful 
if it
is not present.
I also fixed an error with the number of tests in the SMS::Send tests.
---
 C4/SMS.pm                      |    7 ++++++-
 t/lib/KohaTest/SMS/send_sms.pm |    2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/C4/SMS.pm b/C4/SMS.pm
index 959e407..19f1d85 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 c23c47f..d6bbb64 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',
-- 
1.5.6

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to