Bugzilla – Attachment 96987 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-01-08 12:31:55 UTC
(
hide
)
Description:
Bug 21946: Update unit tests to pass under ES
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-01-08 12:31:55 UTC
Size:
14.80 KB
patch
obsolete
>From 38615abdcc005b3c9e701b169b176a42328e6ee3 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 0065f0df0a..afde31274b 100644 >--- a/t/db_dependent/Circulation/TooMany.t >+++ b/t/db_dependent/Circulation/TooMany.t >@@ -65,23 +65,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 >@@ -91,12 +82,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' > ); >@@ -117,7 +108,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, >@@ -126,7 +117,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, >@@ -137,7 +128,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, >@@ -146,7 +137,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, >@@ -173,10 +164,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, >@@ -185,14 +176,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, >@@ -201,7 +192,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, >@@ -229,24 +220,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' > ); >@@ -268,12 +259,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, >@@ -282,14 +273,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, >@@ -298,7 +289,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, >@@ -324,17 +315,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, >@@ -345,7 +336,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, >@@ -354,7 +345,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, >@@ -383,12 +374,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, >@@ -397,14 +388,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, >@@ -413,7 +404,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, >@@ -424,17 +415,17 @@ subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub { > > teardown(); > >- $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, >@@ -445,7 +436,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, >@@ -454,7 +445,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, >@@ -687,13 +678,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