Bugzilla – Attachment 137708 Details for
Bug 31120
Items will renew for zero ( 0 ) days if renewalperiod is blank/empty value
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31120: Add unit tests
Bug-31120-Add-unit-tests.patch (text/plain), 2.09 KB, created by
Kyle M Hall (khall)
on 2022-07-14 10:39:18 UTC
(
hide
)
Description:
Bug 31120: Add unit tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-07-14 10:39:18 UTC
Size:
2.09 KB
patch
obsolete
>From 5f709134f655a622250d8e83ec07bf5fd40826b6 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 14 Jul 2022 10:38:57 +0000 >Subject: [PATCH] Bug 31120: Add unit tests > >--- > t/db_dependent/Circulation/CalcDateDue.t | 39 +++++++++++++++++++++++- > 1 file changed, 38 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Circulation/CalcDateDue.t b/t/db_dependent/Circulation/CalcDateDue.t >index af23654b2be..1721a671474 100755 >--- a/t/db_dependent/Circulation/CalcDateDue.t >+++ b/t/db_dependent/Circulation/CalcDateDue.t >@@ -2,7 +2,7 @@ > > use Modern::Perl; > >-use Test::More tests => 17; >+use Test::More tests => 19; > use Test::MockModule; > use DBI; > use DateTime; >@@ -303,5 +303,42 @@ $calendar->delete_holiday( > weekday => 6 > ); > >+# Renewal period of 0 is valid >+Koha::CirculationRules->search()->delete(); >+Koha::CirculationRules->set_rules( >+ { >+ categorycode => undef, >+ itemtype => undef, >+ branchcode => undef, >+ rules => { >+ issuelength => 9999, >+ renewalperiod => 0, >+ lengthunit => 'days', >+ daysmode => 'Days', >+ } >+ } >+); >+$date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower, 1 ); >+is( $date->ymd, $start_date->ymd, "Dates should match for renewalperiod of 0" ); >+ >+# Renewal period of "" should trigger fallover to issuelength for renewal >+Koha::CirculationRules->search()->delete(); >+Koha::CirculationRules->set_rules( >+ { >+ categorycode => undef, >+ itemtype => undef, >+ branchcode => undef, >+ rules => { >+ issuelength => 7, >+ renewalperiod => q{}, >+ lengthunit => 'days', >+ daysmode => 'Days', >+ } >+ } >+); >+my $renewed_date = $date->clone->add( days => 7 ); >+$date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower, 1 ); >+is( $date->ymd, $renewed_date->ymd, 'Renewal period of "" should trigger fallover to issuelength for renewal' ); >+ > $cache->clear_from_cache($key); > $schema->storage->txn_rollback; >-- >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 31120
:
137333
|
137526
|
137697
|
137708
|
137709
|
137769
|
138177
|
138178