Bug 8220 - QA Followup - Unit Test
authorKyle M Hall <kyle@bywatersolutions.com>
Tue, 11 Dec 2012 19:47:44 +0000 (14:47 -0500)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Fri, 22 Mar 2013 00:35:37 +0000 (20:35 -0400)
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and qa script pass.

Tests done:
- created a .koc file with return, issue and fine payments.
- queued that file into Koha
- created some transactions using the Firefox plugin
- queued that into Koha
- processed files and checked outcome was ok
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
t/db_dependent/Circulation.t
t/db_dependent/lib/KohaTest/Circulation.pm

index 8fab844..31e5960 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-use Test::More tests => 15;
+use Test::More tests => 16;
 
 BEGIN {
     use_ok('C4::Circulation');
@@ -108,3 +108,20 @@ is(
     $CircControl,
     'CircControl reset to its initial value'
 );
+
+# Test C4::Circulation::ProcessOfflinePayment
+my $sth = C4::Context->dbh->prepare("SELECT COUNT(*) FROM accountlines WHERE amount = '-123.45' AND accounttype = 'Pay'");
+$sth->execute();
+my ( $original_count ) = $sth->fetchrow_array();
+
+C4::Context->dbh->do("INSERT INTO borrowers ( cardnumber, surname, firstname, categorycode, branchcode ) VALUES ( '99999999999', 'Hall', 'Kyle', 'S', 'MPL' )");
+
+C4::Circulation::ProcessOfflinePayment({ cardnumber => '99999999999', amount => '123.45' });
+
+$sth->execute();
+my ( $new_count ) = $sth->fetchrow_array();
+
+ok( $new_count == $original_count  + 1, 'ProcessOfflinePayment makes payment correctly' );
+
+C4::Context->dbh->do("DELETE FROM accountlines WHERE borrowernumber IN ( SELECT borrowernumber FROM borrowers WHERE cardnumber = '99999999999' )");
+C4::Context->dbh->do("DELETE FROM borrowers WHERE cardnumber = '99999999999'");
index b3a1ff8..2ec90b2 100644 (file)
@@ -48,6 +48,7 @@ sub methods : Test( 1 ) {
                       CheckRepeatableSpecialHolidays
                       CheckValidBarcode
                       ReturnLostItem
+                      ProcessOfflinePayment
                 );
     
     can_ok( $self->testing_class, @methods );