Bugzilla – Attachment 61543 Details for
Bug 18139
'Too many checked out' can confuse librarians
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18139 - Add additional unit tests
Bug-18139---Add-additional-unit-tests.patch (text/plain), 12.30 KB, created by
Marc Véron
on 2017-03-23 14:44:14 UTC
(
hide
)
Description:
Bug 18139 - Add additional unit tests
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2017-03-23 14:44:14 UTC
Size:
12.30 KB
patch
obsolete
>From 546a282b89402d21f29609d265ef6edae3300976 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 17 Feb 2017 15:23:26 +0000 >Subject: [PATCH] Bug 18139 - Add additional unit tests >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Signed-off-by: Eric Gosselin <eric.gosselin@inlibro.com> > >Tested al patches together, works OK, can no longer reprocuce >internal server error from comment 4. >Regarding "Too meny count" (see BTW in comment #4) I will file a separate bug. >Signed-off-by: Marc Véron <veron@veron.ch> >--- > t/db_dependent/Circulation/TooMany.t | 28 +++++++++++++++++++++++----- > 1 file changed, 23 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/Circulation/TooMany.t b/t/db_dependent/Circulation/TooMany.t >index 1013dd3..9dc143b 100644 >--- a/t/db_dependent/Circulation/TooMany.t >+++ b/t/db_dependent/Circulation/TooMany.t >@@ -91,18 +91,20 @@ C4::Context->set_userenv($patron->{borrowernumber}, $patron->{userid}, 'usercnum > # OSCO: On-site checkout > > subtest 'no rules exist' => sub { >- plan tests => 4; >+ plan tests => 6; > my $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); > is( $too_many->{reason}, 'NO_RULE_DEFINED', 'CO should not be allowed, in any cases' ); > is( $too_many->{max_allowed}, 0, 'CO should not be allowed, in any cases' ); >+ is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); > > $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); > is( $too_many->{reason}, 'NO_RULE_DEFINED', 'CO should not be allowed, in any cases' ); > is( $too_many->{max_allowed}, 0, 'CO should not be allowed, in any cases' ); >+ is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); > }; > > subtest '1 Issuingrule exist 0 0: no issue allowed' => sub { >- plan tests => 12; >+ plan tests => 16; > my $issuingrule = $builder->build({ > source => 'Issuingrule', > value => { >@@ -118,11 +120,13 @@ subtest '1 Issuingrule exist 0 0: no issue allowed' => sub { > is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{count}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{max_allowed}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); >+ is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); > > $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); > is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{count}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{max_allowed}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); >+ is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); > > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); > >@@ -130,11 +134,13 @@ subtest '1 Issuingrule exist 0 0: no issue allowed' => sub { > is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{count}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{max_allowed}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); >+ is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); > > $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); > is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{count}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{max_allowed}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); >+ is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); > > teardown(); > }; >@@ -179,7 +185,7 @@ subtest '1 Issuingrule exist 1 1: issue is allowed' => sub { > }; > > subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub { >- plan tests => 11; >+ plan tests => 14; > my $issuingrule = $builder->build({ > source => 'Issuingrule', > value => { >@@ -199,6 +205,7 @@ subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub { > is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); >+ is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); > > is( > C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), >@@ -212,17 +219,19 @@ subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub { > is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); >+ is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); > > $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); > is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); >+ is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); > > teardown(); > }; > > subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub { >- plan tests => 11; >+ plan tests => 14; > my $issuingrule = $builder->build({ > source => 'Issuingrule', > value => { >@@ -248,17 +257,20 @@ subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub { > is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); >+ is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); > > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); > $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); > is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); >+ is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); > > $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); > is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); >+ is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); > > teardown(); > }; >@@ -267,7 +279,7 @@ subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub { > # Note: the same test coul be done for > # DefaultBorrowerCircRule, DefaultBranchCircRule, DefaultBranchItemRule ans DefaultCircRule.pm > >- plan tests => 22; >+ plan tests => 28; > my $issuingrule = $builder->build({ > source => 'BranchBorrowerCircRule', > value => { >@@ -286,6 +298,7 @@ subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub { > is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{count}, 1, 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{max_allowed}, 1, 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); >+ is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); > > is( > C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), >@@ -298,11 +311,13 @@ subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub { > is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); >+ is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); > > $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); > is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); >+ is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); > > teardown(); > >@@ -320,17 +335,20 @@ subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub { > is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); > is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); >+ is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); > > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); > $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); > is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); >+ is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); > > $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); > is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); > is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); >+ is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); > > teardown(); > }; >-- >2.1.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 18139
:
60427
|
60428
|
60429
|
61489
|
61490
|
61491
|
61541
|
61542
|
61543
|
61663
|
159307
|
159308
|
159522
|
159523
|
159728
|
159729
|
159740
|
159904
|
159905
|
159906
|
159907