Lines 1-14
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
# |
|
|
3 |
# This Koha test module is a stub! |
4 |
# Add more tests here!!! |
5 |
|
2 |
|
6 |
use strict; |
3 |
use Modern::Perl; |
7 |
use warnings; |
|
|
8 |
|
4 |
|
9 |
use Test::More tests => 1; |
5 |
use t::lib::Mocks; |
|
|
6 |
|
7 |
use Test::More tests => 7; |
10 |
|
8 |
|
11 |
BEGIN { |
9 |
BEGIN { |
12 |
use_ok('C4::SMS'); |
10 |
use_ok('C4::SMS'); |
13 |
} |
11 |
} |
14 |
|
12 |
|
15 |
- |
13 |
|
|
|
14 |
my $driver = 'my mock driver'; |
15 |
t::lib::Mocks::mock_preference('SMSSendDriver', $driver); |
16 |
is( C4::SMS->driver(), $driver, 'driver returns the SMSSendDriver correctly' ); |
17 |
|
18 |
|
19 |
my $send_sms = C4::SMS->send_sms(); |
20 |
is( $send_sms, undef, 'send_sms without arguments returns undef' ); |
21 |
|
22 |
$send_sms = C4::SMS->send_sms({ |
23 |
destination => 'my destination', |
24 |
}); |
25 |
is( $send_sms, undef, 'send_sms without message returns undef' ); |
26 |
|
27 |
$send_sms = C4::SMS->send_sms({ |
28 |
message => 'my message', |
29 |
}); |
30 |
is( $send_sms, undef, 'send_sms without destination returns undef' ); |
31 |
|
32 |
$send_sms = C4::SMS->send_sms({ |
33 |
destination => 'my destination', |
34 |
message => 'my message', |
35 |
driver => '', |
36 |
}); |
37 |
is( $send_sms, undef, 'send_sms with an undef driver returns undef' ); |
38 |
|
39 |
$send_sms = C4::SMS->send_sms({ |
40 |
destination => '+33123456789', |
41 |
message => 'my message', |
42 |
driver => 'Test', |
43 |
}); |
44 |
is( $send_sms, 1, 'send_sms returns 1' ); |