Bugzilla – Attachment 107039 Details for
Bug 21946
Group circulation by item type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21946: Update unit tests to pass under ES
Bug-21946-Update-unit-tests-to-pass-under-ES.patch (text/plain), 14.80 KB, created by
Nick Clemens (kidclamp)
on 2020-07-17 15:22:40 UTC
(
hide
)
Description:
Bug 21946: Update unit tests to pass under ES
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-07-17 15:22:40 UTC
Size:
14.80 KB
patch
obsolete
>From 75823052e5ce42a076e271111082a15aa88be982 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 8 Jan 2020 12:30:41 +0000 >Subject: [PATCH] Bug 21946: Update unit tests to pass under ES > >--- > t/db_dependent/Circulation/TooMany.t | 93 ++++++++++++++++-------------------- > 1 file changed, 42 insertions(+), 51 deletions(-) > >diff --git a/t/db_dependent/Circulation/TooMany.t b/t/db_dependent/Circulation/TooMany.t >index 40c0c13d59..233c21a37a 100644 >--- a/t/db_dependent/Circulation/TooMany.t >+++ b/t/db_dependent/Circulation/TooMany.t >@@ -64,23 +64,14 @@ my $patron = $builder->build({ > }, > }); > >-my $biblio = $builder->build({ >- source => 'Biblio', >- value => { >- branchcode => $branch->{branchcode}, >- }, >-}); >-my $item = $builder->build({ >- source => 'Item', >- value => { >- biblionumber => $biblio->{biblionumber}, >- homebranch => $branch->{branchcode}, >- holdingbranch => $branch->{branchcode}, >- }, >+my $biblio = $builder->build_sample_biblio({ branchcode => $branch->{branchcode} }); >+my $item = $builder->build_sample_item({ >+ biblionumber => $biblio->biblionumber, >+ homebranch => $branch->{branchcode}, >+ holdingbranch => $branch->{branchcode}, > }); > > my $patron_object = Koha::Patrons->find( $patron->{borrowernumber} ); >-my $item_object = Koha::Items->find( $item->{itemnumber} ); > t::lib::Mocks::mock_userenv( { patron => $patron_object }); > > # TooMany return ($current_loan_count, $max_loans_allowed) or undef >@@ -90,12 +81,12 @@ t::lib::Mocks::mock_userenv( { patron => $patron_object }); > subtest 'no rules exist' => sub { > plan tests => 2; > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > { reason => 'NO_RULE_DEFINED', max_allowed => 0 }, > 'CO should not be allowed, in any cases' > ); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > { reason => 'NO_RULE_DEFINED', max_allowed => 0 }, > 'OSCO should not be allowed, in any cases' > ); >@@ -116,7 +107,7 @@ subtest '1 Issuingrule exist 0 0: no issue allowed' => sub { > ); > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > { > reason => 'TOO_MANY_CHECKOUTS', > count => 0, >@@ -125,7 +116,7 @@ subtest '1 Issuingrule exist 0 0: no issue allowed' => sub { > 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' > ); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > { > reason => 'TOO_MANY_ONSITE_CHECKOUTS', > count => 0, >@@ -136,7 +127,7 @@ subtest '1 Issuingrule exist 0 0: no issue allowed' => sub { > > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > { > reason => 'TOO_MANY_CHECKOUTS', > count => 0, >@@ -145,7 +136,7 @@ subtest '1 Issuingrule exist 0 0: no issue allowed' => sub { > 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' > ); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > { > reason => 'TOO_MANY_ONSITE_CHECKOUTS', > count => 0, >@@ -172,10 +163,10 @@ subtest '1 Issuingrule exist with onsiteissueqty=unlimited' => sub { > }, > ); > >- my $issue = C4::Circulation::AddIssue( $patron, $item->{barcode}, dt_from_string() ); >+ my $issue = C4::Circulation::AddIssue( $patron, $item->barcode, dt_from_string() ); > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > { > reason => 'TOO_MANY_CHECKOUTS', > count => 1, >@@ -184,14 +175,14 @@ subtest '1 Issuingrule exist with onsiteissueqty=unlimited' => sub { > 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' > ); > is( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > undef, > 'OSCO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' > ); > > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > { > reason => 'TOO_MANY_CHECKOUTS', > count => 1, >@@ -200,7 +191,7 @@ subtest '1 Issuingrule exist with onsiteissueqty=unlimited' => sub { > 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' > ); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > { > reason => 'TOO_MANY_CHECKOUTS', > count => 1, >@@ -228,24 +219,24 @@ subtest '1 Issuingrule exist 1 1: issue is allowed' => sub { > ); > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); > is( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > undef, > 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' > ); > is( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > undef, > 'OSCO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' > ); > > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); > is( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > undef, > 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' > ); > is( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > undef, > 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' > ); >@@ -267,12 +258,12 @@ subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub { > } > ); > >- my $issue = C4::Circulation::AddIssue( $patron, $item->{barcode}, dt_from_string() ); >+ my $issue = C4::Circulation::AddIssue( $patron, $item->barcode, dt_from_string() ); > like( $issue->issue_id, qr|^\d+$|, 'The issue should have been inserted' ); > > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > { > reason => 'TOO_MANY_CHECKOUTS', > count => 1, >@@ -281,14 +272,14 @@ subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub { > 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' > ); > is( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > undef, > 'OSCO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' > ); > > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > { > reason => 'TOO_MANY_CHECKOUTS', > count => 1, >@@ -297,7 +288,7 @@ subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub { > 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' > ); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > { > reason => 'TOO_MANY_CHECKOUTS', > count => 1, >@@ -323,17 +314,17 @@ subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub { > } > ); > >- my $issue = C4::Circulation::AddIssue( $patron, $item->{barcode}, dt_from_string(), undef, undef, undef, { onsite_checkout => 1 } ); >+ my $issue = C4::Circulation::AddIssue( $patron, $item->barcode, dt_from_string(), undef, undef, undef, { onsite_checkout => 1 } ); > like( $issue->issue_id, qr|^\d+$|, 'The issue should have been inserted' ); > > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); > is( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > undef, > 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' > ); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > { > reason => 'TOO_MANY_ONSITE_CHECKOUTS', > count => 1, >@@ -344,7 +335,7 @@ subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub { > > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > { > reason => 'TOO_MANY_CHECKOUTS', > count => 1, >@@ -353,7 +344,7 @@ subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub { > 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' > ); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > { > reason => 'TOO_MANY_ONSITE_CHECKOUTS', > count => 1, >@@ -382,12 +373,12 @@ subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub { > } > ); > >- my $issue = C4::Circulation::AddIssue( $patron, $item->{barcode}, dt_from_string(), undef, undef, undef ); >+ my $issue = C4::Circulation::AddIssue( $patron, $item->barcode, dt_from_string(), undef, undef, undef ); > like( $issue->issue_id, qr|^\d+$|, 'The issue should have been inserted' ); > > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > { > reason => 'TOO_MANY_CHECKOUTS', > count => 1, >@@ -396,14 +387,14 @@ subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub { > 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' > ); > is( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > undef, > 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' > ); > > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > { > reason => 'TOO_MANY_CHECKOUTS', > count => 1, >@@ -412,7 +403,7 @@ subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub { > 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' > ); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > { > reason => 'TOO_MANY_CHECKOUTS', > count => 1, >@@ -434,17 +425,17 @@ subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub { > } > ); > >- $issue = C4::Circulation::AddIssue( $patron, $item->{barcode}, dt_from_string(), undef, undef, undef, { onsite_checkout => 1 } ); >+ $issue = C4::Circulation::AddIssue( $patron, $item->barcode, dt_from_string(), undef, undef, undef, { onsite_checkout => 1 } ); > like( $issue->issue_id, qr|^\d+$|, 'The issue should have been inserted' ); > > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); > is( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > undef, > 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' > ); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > { > reason => 'TOO_MANY_ONSITE_CHECKOUTS', > count => 1, >@@ -455,7 +446,7 @@ subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub { > > t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > { > reason => 'TOO_MANY_CHECKOUTS', > count => 1, >@@ -464,7 +455,7 @@ subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub { > 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' > ); > is_deeply( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > { > reason => 'TOO_MANY_ONSITE_CHECKOUTS', > count => 1, >@@ -698,13 +689,13 @@ subtest 'empty string means unlimited' => sub { > }, > ); > is( >- C4::Circulation::TooMany( $patron, $item_object ), >+ C4::Circulation::TooMany( $patron, $item ), > undef, > 'maxissueqty="" should mean unlimited' > ); > > is( >- C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ), >+ C4::Circulation::TooMany( $patron, $item, { onsite_checkout => 1 } ), > undef, > 'maxonsiteissueqty="" should mean unlimited' > ); >-- >2.11.0
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 21946
:
87713
|
87714
|
87715
|
87716
|
87717
|
87718
|
87719
|
88392
|
88574
|
88575
|
88576
|
88577
|
88578
|
88579
|
88580
|
88581
|
88926
|
88927
|
88928
|
88929
|
88930
|
88931
|
88932
|
88933
|
88934
|
89167
|
89168
|
89169
|
89170
|
89171
|
89172
|
89173
|
89174
|
89175
|
89176
|
93075
|
93076
|
93077
|
93078
|
93079
|
93080
|
93081
|
93082
|
93083
|
93084
|
93086
|
93087
|
93088
|
93089
|
93090
|
93091
|
93092
|
93093
|
93094
|
93095
|
93096
|
93097
|
93098
|
93099
|
93100
|
93101
|
93102
|
93103
|
93104
|
93105
|
96977
|
96978
|
96979
|
96980
|
96981
|
96982
|
96983
|
96984
|
96985
|
96986
|
96987
|
99419
|
99420
|
99421
|
99422
|
99423
|
99424
|
107035
|
107036
|
107037
|
107038
|
107039
|
107040
|
107041
|
107278
|
107279
|
107280
|
107281
|
107282
|
107283
|
107284
|
107467
|
107489
|
107686
|
107687
|
107688
|
107689
|
107690
|
107691
|
107692
|
107693
|
107694
|
107701
|
107733