Bugzilla – Attachment 44949 Details for
Bug 14101
auto renewal is tied to 'no renewal before'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14101: Unit tests
Bug-14101-Unit-tests.patch (text/plain), 4.53 KB, created by
Holger Meißner
on 2015-11-18 09:29:53 UTC
(
hide
)
Description:
Bug 14101: Unit tests
Filename:
MIME Type:
Creator:
Holger Meißner
Created:
2015-11-18 09:29:53 UTC
Size:
4.53 KB
patch
obsolete
>From 6599e4f851646d7a12053baa8cdffdb27af3ec84 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Holger=20Mei=C3=9Fner?= <h.meissner.82@web.de> >Date: Tue, 22 Sep 2015 14:03:33 +0200 >Subject: [PATCH] Bug 14101: Unit tests >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch adds new test cases to check if CanBookBeRenewed provides >correct return values and error codes for premature renewals. Both manual >and automatic renewals and different settings for 'No renewal before' >are tested. > >To test: >1) prove t/db_dependent/Circulation.t > >Sponsored-by: Hochschule für Gesundheit (hsg), Germany >--- > t/db_dependent/Circulation.t | 42 +++++++++++++++++++++++++++++++----------- > 1 file changed, 31 insertions(+), 11 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 5004b41..12edb53 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -29,7 +29,7 @@ use Koha::Database; > > use t::lib::TestBuilder; > >-use Test::More tests => 78 ; >+use Test::More tests => 82; > > BEGIN { > use_ok('C4::Circulation'); >@@ -175,7 +175,7 @@ $dbh->do( > '*', '*', '*', 25, > 20, 14, 'days', > 1, 7, >- '', 0, >+ undef, 0, > .10, 1 > ); > >@@ -470,28 +470,48 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > AddIssue( $renewing_borrower, $barcode4, undef, undef, undef, undef, { auto_renew => 1 } ); > ( $renewokay, $error ) = > CanBookBeRenewed( $renewing_borrowernumber, $itemnumber4 ); >- is( $renewokay, 0, 'Cannot renew, renewal is automatic' ); >- is( $error, 'auto_renew', >- 'Cannot renew, renewal is automatic (returned code is auto_renew)' ); >+ is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic and premature' ); >+ is( $error, 'auto_too_soon', >+ 'Bug 14101: Cannot renew, renewal is automatic and premature, "No renewal before" = undef (returned code is auto_too_soon)' ); > > # set policy to require that loans cannot be > # renewed until seven days prior to the due date > $dbh->do('UPDATE issuingrules SET norenewalbefore = 7'); > ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber); >- is( $renewokay, 0, 'Cannot renew, renewal is premature'); >- is( $error, 'too_soon', 'Cannot renew, renewal is premature (returned code is too_soon)'); >+ is( $renewokay, 0, 'Bug 7413: Cannot renew, renewal is premature'); >+ is( $error, 'too_soon', 'Bug 7413: Cannot renew, renewal is premature (returned code is too_soon)'); > is( > GetSoonestRenewDate($renewing_borrowernumber, $itemnumber), > $datedue->clone->add(days => -7), >- 'renewals permitted 7 days before due date, as expected', >+ 'Bug 7413: Renewals permitted 7 days before due date, as expected', > ); > > # Test automatic renewal again > ( $renewokay, $error ) = > CanBookBeRenewed( $renewing_borrowernumber, $itemnumber4 ); >- is( $renewokay, 0, 'Cannot renew, renewal is automatic and premature' ); >+ is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic and premature' ); >+ is( $error, 'auto_too_soon', >+'Bug 14101: Cannot renew, renewal is automatic and premature (returned code is auto_too_soon)' >+ ); >+ >+ # Change policy so that loans can only be renewed exactly on due date (0 days prior to due date) >+ # and test automatic renewal again >+ $dbh->do('UPDATE issuingrules SET norenewalbefore = 0'); >+ ( $renewokay, $error ) = >+ CanBookBeRenewed( $renewing_borrowernumber, $itemnumber4 ); >+ is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic and premature' ); > is( $error, 'auto_too_soon', >-'Cannot renew, renewal is automatic and premature (returned code is auto_too_soon)' >+'Bug 14101: Cannot renew, renewal is automatic and premature, "No renewal before" = 0 (returned code is auto_too_soon)' >+ ); >+ >+ # Change policy so that loans can be renewed 99 days prior to the due date >+ # and test automatic renewal again >+ $dbh->do('UPDATE issuingrules SET norenewalbefore = 99'); >+ ( $renewokay, $error ) = >+ CanBookBeRenewed( $renewing_borrowernumber, $itemnumber4 ); >+ is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic' ); >+ is( $error, 'auto_renew', >+'Bug 14101: Cannot renew, renewal is automatic (returned code is auto_renew)' > ); > > # Too many renewals >@@ -693,7 +713,7 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > '*', '*', '*', 25, > 20, 14, 'days', > 1, 7, >- '', 0, >+ undef, 0, > .10, 1 > ); > my $biblio = MARC::Record->new(); >-- >1.7.10.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 14101
:
39800
|
39802
|
39829
|
42773
|
43808
|
43809
|
44948
|
44949
|
44990
|
44991