Bugzilla – Attachment 136748 Details for
Bug 30901
Add template method to be able to look up renewal data in Koha slips and notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30901: Add Unit Tests
Bug-30901-Add-Unit-Tests.patch (text/plain), 3.45 KB, created by
Kyle M Hall (khall)
on 2022-06-29 19:02:13 UTC
(
hide
)
Description:
Bug 30901: Add Unit Tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-06-29 19:02:13 UTC
Size:
3.45 KB
patch
obsolete
>From 897a0fbbca6f0786bdcf45291dc33e8c111ed661 Mon Sep 17 00:00:00 2001 >From: Kyle Hall <kyle@bywatersolutions.com> >Date: Wed, 29 Jun 2022 15:01:38 -0400 >Subject: [PATCH] Bug 30901: Add Unit Tests > >--- > .../Koha/Template/Plugin/CirculationRules.t | 90 +++++++++++++++++++ > 1 file changed, 90 insertions(+) > create mode 100755 t/db_dependent/Koha/Template/Plugin/CirculationRules.t > >diff --git a/t/db_dependent/Koha/Template/Plugin/CirculationRules.t b/t/db_dependent/Koha/Template/Plugin/CirculationRules.t >new file mode 100755 >index 00000000000..458920d4d48 >--- /dev/null >+++ b/t/db_dependent/Koha/Template/Plugin/CirculationRules.t >@@ -0,0 +1,90 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Test::More tests => 8; >+ >+use C4::Context; >+use C4::Circulation qw(AddIssue); >+use Koha::Database; >+use Koha::CirculationRules; >+ >+use t::lib::TestBuilder; >+use t::lib::Mocks; >+ >+BEGIN { >+ use_ok('Koha::Template::Plugin::CirculationRules'); >+} >+ >+my $schema = Koha::Database->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+$schema->storage->txn_begin; >+my $dbh = C4::Context->dbh; >+ >+$dbh->do('DELETE FROM circulation_rules'); >+Koha::CirculationRules->set_rules( >+ { >+ categorycode => undef, >+ branchcode => undef, >+ itemtype => undef, >+ rules => { >+ reservesallowed => 25, >+ issuelength => 14, >+ lengthunit => 'days', >+ renewalsallowed => 1, >+ renewalperiod => 7, >+ norenewalbefore => undef, >+ auto_renew => 0, >+ fine => .10, >+ chargeperiod => 1, >+ renewalsallowed => 111, >+ unseen_renewals_allowed => 222, >+ } >+ } >+); >+ >+my $plugin = Koha::Template::Plugin::CirculationRules->new(); >+ok( $plugin, "initialized CirculationRules plugin" ); >+ >+my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+my $biblio = $builder->build_sample_biblio(); >+ >+t::lib::Mocks::mock_userenv( { branchcode => $patron->branchcode } ); >+ >+# Item at each patron branch >+my $item = $builder->build_sample_item( >+ { >+ biblionumber => $biblio->biblionumber, >+ homebranch => $patron->branchcode >+ } >+); >+ >+my $issue = AddIssue( $patron->unblessed, $item->barcode ); >+ >+my $rules = $plugin->Renewals( $patron->id, $item->id ); >+ >+is( $rules->{unseen_allowed}, 222, "Unseen allowed is correct" ); >+is( $rules->{remaining}, 111, "Remaining is correct" ); >+is( $rules->{unseen_count}, 0, "Unseen count is correct" ); >+is( $rules->{unseen_remaining}, 222, "Unseen remaining is correct" ); >+is( $rules->{count}, 0, "Count renewals is correct" ); >+is( $rules->{allowed}, 111, "Allowed is correct" ); >+ >+$schema->storage->txn_rollback; >+ >+1; >-- >2.30.2
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 30901
:
135687
|
135688
|
135689
|
135690
|
135691
|
135692
|
135693
|
136748
|
139086
|
139087
|
139088