Bug 12455: adding unit tests for the module C4/SMS.pm

The module C4/SMS.pm was not tested

Test plan:
1/ Execute the command : prove t/SMS.t
2/ The result has to be a success without error or warning :
t/SMS.t .. ok
All tests successful.
Files=1, Tests=7,  1 wallclock secs ( 0.03 usr  0.01 sys +  0.17 cusr  0.02 csys =  0.23 CPU)
Result: PASS

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Replace stub test, all test pass.
Removed "use strict/warnings", no need for that with "use Modern::Perl"
No koha-qa errors

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Yohann Dufour 2014-06-20 10:42:13 +02:00 committed by Tomas Cohen Arazi
parent 059f201710
commit 51d881069e
1 changed files with 37 additions and 7 deletions

44
t/SMS.t
View File

@ -1,14 +1,44 @@
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Modern::Perl;
use Test::More tests => 1;
use t::lib::Mocks;
use Test::More tests => 7;
BEGIN {
use_ok('C4::SMS');
use_ok('C4::SMS');
}
my $driver = 'my mock driver';
t::lib::Mocks::mock_preference('SMSSendDriver', $driver);
is( C4::SMS->driver(), $driver, 'driver returns the SMSSendDriver correctly' );
my $send_sms = C4::SMS->send_sms();
is( $send_sms, undef, 'send_sms without arguments returns undef' );
$send_sms = C4::SMS->send_sms({
destination => 'my destination',
});
is( $send_sms, undef, 'send_sms without message returns undef' );
$send_sms = C4::SMS->send_sms({
message => 'my message',
});
is( $send_sms, undef, 'send_sms without destination returns undef' );
$send_sms = C4::SMS->send_sms({
destination => 'my destination',
message => 'my message',
driver => '',
});
is( $send_sms, undef, 'send_sms with an undef driver returns undef' );
$send_sms = C4::SMS->send_sms({
destination => '+33123456789',
message => 'my message',
driver => 'Test',
});
is( $send_sms, 1, 'send_sms returns 1' );