Bug 5327: Added unit test for C4/SIP/ILS/Transaction/RenewAll.pm
authorDuncan Tyler <duncan@catalyst.net.nz>
Wed, 14 Dec 2011 03:42:30 +0000 (16:42 +1300)
committerPaul Poulain <paul.poulain@biblibre.com>
Fri, 16 Dec 2011 14:43:04 +0000 (15:43 +0100)
http://bugs.koha-community.org/show_bug.cgi?id=5327
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Test requires a database installed using the sample data.
All tests pass.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
t/SIP_ILS.t [deleted file]
t/db_dependent/SIP_ILS.t [new file with mode: 0755]

diff --git a/t/SIP_ILS.t b/t/SIP_ILS.t
deleted file mode 100755 (executable)
index 4a3ee70..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/perl
-#
-# This Koha test module is a stub!  
-# Add more tests here!!!
-
-use strict;
-use warnings;
-
-use Test::More tests => 1;
-
-BEGIN {
-        use FindBin;
-        use lib "$FindBin::Bin/../C4/SIP";
-        use_ok('C4::SIP::ILS');
-}
-
diff --git a/t/db_dependent/SIP_ILS.t b/t/db_dependent/SIP_ILS.t
new file mode 100755 (executable)
index 0000000..daf1c29
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+#
+# This Koha test module is a stub!
+# Add more tests here!!!
+
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+BEGIN {
+        use FindBin;
+        use lib "$FindBin::Bin/../../C4/SIP";
+        use_ok('C4::SIP::ILS');
+};
+
+my $transaction = ILS::Transaction::RenewAll->new();
+
+$transaction->patron(my $patron = ILS::Patron->new(23529000120056));
+
+ok(defined $patron, "patron code: 23529000120056 is valid");
+
+my $transaction2 = ILS::Transaction::RenewAll->new();
+$transaction2->patron(my $patron2 = ILS::Patron->new("ABCDE12345"));
+
+#This test assumes that the patron code ABCDE12345 is invalid
+ok(!defined $patron2, "patron code: ABCDE12345 is invalid");
+
+ok($transaction->do_renew_all(), "items renewed correctly");