Bug 11703: (followup) svc/holds invoked with trailing .pl
[koha.git] / t / SMS.t
blob99018582462936fe2b0675dd98794fe7fc96316f
1 #!/usr/bin/perl
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
18 use Modern::Perl;
20 use t::lib::Mocks;
22 use Test::More tests => 7;
24 BEGIN {
25 use_ok('C4::SMS');
29 my $driver = 'my mock driver';
30 t::lib::Mocks::mock_preference('SMSSendDriver', $driver);
31 is( C4::SMS->driver(), $driver, 'driver returns the SMSSendDriver correctly' );
34 my $send_sms = C4::SMS->send_sms();
35 is( $send_sms, undef, 'send_sms without arguments returns undef' );
37 $send_sms = C4::SMS->send_sms({
38 destination => 'my destination',
39 });
40 is( $send_sms, undef, 'send_sms without message returns undef' );
42 $send_sms = C4::SMS->send_sms({
43 message => 'my message',
44 });
45 is( $send_sms, undef, 'send_sms without destination returns undef' );
47 $send_sms = C4::SMS->send_sms({
48 destination => 'my destination',
49 message => 'my message',
50 driver => '',
51 });
52 is( $send_sms, undef, 'send_sms with an undef driver returns undef' );
54 $send_sms = C4::SMS->send_sms({
55 destination => '+33123456789',
56 message => 'my message',
57 driver => 'Test',
58 });
59 is( $send_sms, 1, 'send_sms returns 1' );