Bugzilla – Attachment 52209 Details for
Bug 14803
Rental and fine fees are not updating on circulation screen
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Test rental charges properly
Test-rental-charges-properly.patch (text/plain), 3.90 KB, created by
Srdjan Jankovic
on 2016-06-10 00:58:25 UTC
(
hide
)
Description:
Test rental charges properly
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2016-06-10 00:58:25 UTC
Size:
3.90 KB
patch
obsolete
>From a1c8a4774e725f06e7fa48b477980de2882f6613 Mon Sep 17 00:00:00 2001 >From: Srdjan <srdjan@catalyst.net.nz> >Date: Fri, 10 Jun 2016 12:42:54 +1200 >Subject: [PATCH] Test rental charges properly > >* AddIssuingCharge() test was always returning pass - removed and > replaced with: >* Test rental charges properly for both checkout and renewal > >https://bugs.koha-community.org/show_bug.cgi?id=14803 >--- > t/db_dependent/Circulation/issue.t | 49 ++++++++++++++++++++++++++------------ > 1 file changed, 34 insertions(+), 15 deletions(-) > >diff --git a/t/db_dependent/Circulation/issue.t b/t/db_dependent/Circulation/issue.t >index bbb7909..040b9ed 100644 >--- a/t/db_dependent/Circulation/issue.t >+++ b/t/db_dependent/Circulation/issue.t >@@ -16,6 +16,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >+use Data::Dumper; > > use Koha::DateUtils; > use DateTime::Duration; >@@ -143,6 +144,15 @@ $dbh->do( > $samplecat->{category_type} > ); > >+my $TEST_ITEMTYPE = "_T_ITYPE"; >+my %TEST_ITEMTYPE_REC = ( >+ itemtype => $TEST_ITEMTYPE, >+ rentalcharge => "1.50", >+); >+Koha::ItemType->new(\%TEST_ITEMTYPE_REC)->store; >+ >+t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); >+ > #Add biblio and item > my $record = MARC::Record->new(); > $record->append_fields( >@@ -158,7 +168,8 @@ my @sampleitem1 = C4::Items::AddItem( > homebranch => $samplebranch1->{branchcode}, > holdingbranch => $samplebranch1->{branchcode}, > issue => 1, >- reserve => 1 >+ reserve => 1, >+ itype => $TEST_ITEMTYPE, > }, > $biblionumber > ); >@@ -170,7 +181,8 @@ my @sampleitem2 = C4::Items::AddItem( > homebranch => $samplebranch2->{branchcode}, > holdingbranch => $samplebranch2->{branchcode}, > notforloan => 1, >- issue => 1 >+ issue => 1, >+ itype => $TEST_ITEMTYPE, > }, > $biblionumber > ); >@@ -209,9 +221,16 @@ my $userenv = C4::Context->userenv > > #Begin Tests > >+my $bib = GetBiblioFromItemNumber( $item_id1); >+$query = " SELECT count(*) FROM accountlines"; >+my $sth = $dbh->prepare($query); >+$sth->execute; >+my $countaccount = $sth -> fetchrow_array; >+is ($countaccount,0,"0 accountline exists"); >+ > #Test AddIssue > $query = " SELECT count(*) FROM issues"; >-my $sth = $dbh->prepare($query); >+$sth = $dbh->prepare($query); > $sth->execute; > my $countissue = $sth -> fetchrow_array; > is ($countissue ,0, "there is no issue"); >@@ -232,20 +251,16 @@ my $issue_id2 = $dbh->last_insert_id( undef, undef, 'issues', undef ); > > $sth->execute; > $countissue = $sth -> fetchrow_array; >-is ($countissue,1,"1 issues have been added"); >+is ($countissue,1,"1 issue has been added"); > > #Test AddIssuingCharge >-$query = " SELECT count(*) FROM accountlines"; >-$sth = $dbh->prepare($query); >-$sth->execute; >-my $countaccount = $sth -> fetchrow_array; >-is ($countaccount,0,"0 accountline exists"); >-is( C4::Circulation::AddIssuingCharge( $item_id1, $borrower_id1, 10 ), >- 1, "An issuing charge has been added" ); >-my $account_id = $dbh->last_insert_id( undef, undef, 'accountlines', undef ); >-$sth->execute; >-$countaccount = $sth -> fetchrow_array; >-is ($countaccount,1,"1 accountline has been added"); >+$query = " SELECT * FROM accountlines"; >+my $acc_sth = $dbh->prepare($query); >+$acc_sth->execute; >+my $account = $acc_sth -> fetchall_arrayref({}); >+ok (scalar(@$account) == 1 && $account->[0]{accounttype} eq "Rent","accountline has been added") >+ or diag( Dumper($account) ); >+ > > #Test AddRenewal > my $datedue3 = >@@ -256,6 +271,10 @@ like( > qr/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/, > "AddRenewal returns a date" > ); >+$acc_sth->execute; >+$account = $acc_sth -> fetchall_arrayref({}); >+ok (scalar(@$account) == 2 && $account->[1]{accounttype} eq "Rent","another accountline has been added") >+ or diag( Dumper($account) ); > > #Test GetBiblioIssues > is( GetBiblioIssues(), undef, "GetBiblio Issues without parameters" ); >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14803
:
52208
|
52209
|
52210
|
52473
|
52474
|
53406
|
53482
|
60629
|
60630
|
60631
|
62294
|
62432
|
63047
|
63153
|
63230
|
65696
|
65697
|
65698
|
65783
|
65868
|
66261
|
73541
|
73542
|
98891
|
98892
|
115620
|
115621