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 |
|
|
|
3 |
use Modern::Perl; |
6 |
use strict; |
4 |
use strict; |
7 |
use warnings; |
5 |
use warnings; |
8 |
|
6 |
|
9 |
use Test::More tests => 1; |
7 |
use t::lib::Mocks; |
|
|
8 |
|
9 |
use Test::More tests => 7; |
10 |
|
10 |
|
11 |
BEGIN { |
11 |
BEGIN { |
12 |
use_ok('C4::SMS'); |
12 |
use_ok('C4::SMS'); |
13 |
} |
13 |
} |
14 |
|
14 |
|
15 |
- |
15 |
|
|
|
16 |
my $driver = 'my mock driver'; |
17 |
t::lib::Mocks::mock_preference('SMSSendDriver', $driver); |
18 |
is( C4::SMS->driver(), $driver, 'driver returns the SMSSendDriver correctly' ); |
19 |
|
20 |
|
21 |
my $send_sms = C4::SMS->send_sms(); |
22 |
is( $send_sms, undef, 'send_sms without arguments returns undef' ); |
23 |
|
24 |
$send_sms = C4::SMS->send_sms({ |
25 |
destination => 'my destination', |
26 |
}); |
27 |
is( $send_sms, undef, 'send_sms without message returns undef' ); |
28 |
|
29 |
$send_sms = C4::SMS->send_sms({ |
30 |
message => 'my message', |
31 |
}); |
32 |
is( $send_sms, undef, 'send_sms without destination returns undef' ); |
33 |
|
34 |
$send_sms = C4::SMS->send_sms({ |
35 |
destination => 'my destination', |
36 |
message => 'my message', |
37 |
driver => '', |
38 |
}); |
39 |
is( $send_sms, undef, 'send_sms with an undef driver returns undef' ); |
40 |
|
41 |
$send_sms = C4::SMS->send_sms({ |
42 |
destination => '+33123456789', |
43 |
message => 'my message', |
44 |
driver => 'Test', |
45 |
}); |
46 |
is( $send_sms, 1, 'send_sms returns 1' ); |