bug 2275: making SMS::Send module optional

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.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Andrew Moore 2008-07-03 14:08:46 -05:00 committed by Joshua Ferraro
parent 3c844e0cb3
commit 86239ea689
2 changed files with 7 additions and 2 deletions

View File

@ -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;

View File

@ -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',