Bugzilla – Attachment 88452 Details for
Bug 14576
Allow automatic update of location on checkin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14576: Unit tests
Bug-14576-Unit-tests.patch (text/plain), 7.47 KB, created by
Josef Moravec
on 2019-04-23 12:05:04 UTC
(
hide
)
Description:
Bug 14576: Unit tests
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2019-04-23 12:05:04 UTC
Size:
7.47 KB
patch
obsolete
>From c820d24bcbe3990f95d4d804b63a4de65723061c Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 4 Oct 2017 15:21:57 +0000 >Subject: [PATCH] Bug 14576: Unit tests > >To test: >1 - prove -v t/db_dependent/Circulation/Returns.t >2 - prove -v t/db_dependent/Circulation/issue.t >3 - prove -v t/db_dependent/UsageStats.t >4 - All should pass > >Signed-off-by: Michal Denar <black23@gmail.com> > >Signed-off-by: Michal Denar <black23@gmail.com> > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> >--- > t/db_dependent/Circulation/Returns.t | 48 ++------------------------------ > t/db_dependent/Circulation/issue.t | 54 +++++++++++++++++++++++++++++++++++- > t/db_dependent/UsageStats.t | 2 -- > 3 files changed, 56 insertions(+), 48 deletions(-) > >diff --git a/t/db_dependent/Circulation/Returns.t b/t/db_dependent/Circulation/Returns.t >index 2f09606de5..66456687fe 100644 >--- a/t/db_dependent/Circulation/Returns.t >+++ b/t/db_dependent/Circulation/Returns.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 5; >+use Test::More tests => 4; > use Test::MockModule; > use Test::Warn; > >@@ -68,50 +68,6 @@ my $rule = Koha::IssuingRule->new( > ); > $rule->store(); > >-my $manager = $builder->build({source => 'Borrower'}); >-$manager_id = $manager->{borrowernumber}; >- >-subtest "InProcessingToShelvingCart tests" => sub { >- >- plan tests => 2; >- >- $branch = $builder->build({ source => 'Branch' })->{ branchcode }; >- my $permanent_location = 'TEST'; >- my $location = 'PROC'; >- >- # Create a biblio record with biblio-level itemtype >- my $record = MARC::Record->new(); >- my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '' ); >- my $built_item = $builder->build({ >- source => 'Item', >- value => { >- biblionumber => $biblionumber, >- homebranch => $branch, >- holdingbranch => $branch, >- location => $location, >- permanent_location => $permanent_location >- } >- }); >- my $barcode = $built_item->{ barcode }; >- my $itemnumber = $built_item->{ itemnumber }; >- my $item; >- >- t::lib::Mocks::mock_preference( "InProcessingToShelvingCart", 1 ); >- AddReturn( $barcode, $branch ); >- $item = Koha::Items->find( $itemnumber ); >- is( $item->location, 'CART', >- "InProcessingToShelvingCart functions as intended" ); >- >- ModItem( {location => $location}, undef, $itemnumber ); >- >- t::lib::Mocks::mock_preference( "InProcessingToShelvingCart", 0 ); >- AddReturn( $barcode, $branch ); >- $item = Koha::Items->find( $itemnumber ); >- is( $item->location, $permanent_location, >- "InProcessingToShelvingCart functions as intended" ); >-}; >- >- > subtest "AddReturn logging on statistics table (item-level_itypes=1)" => sub { > > plan tests => 4; >@@ -382,3 +338,5 @@ subtest 'BlockReturnOfLostItems' => sub { > ( $doreturn, $messages, $issue ) = AddReturn($item->barcode); > is( $doreturn, 1, "Without BlockReturnOfLostItems, a checkin of a lost item should not be blocked"); > }; >+ >+$schema->storage->txn_rollback; >diff --git a/t/db_dependent/Circulation/issue.t b/t/db_dependent/Circulation/issue.t >index 97c390211d..31dd457252 100644 >--- a/t/db_dependent/Circulation/issue.t >+++ b/t/db_dependent/Circulation/issue.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 33; >+use Test::More tests => 45; > use DateTime::Duration; > > use t::lib::Mocks; >@@ -373,6 +373,58 @@ AddReturn( 'barcode_3', $branchcode_1 ); > $item = Koha::Items->find( $itemnumber ); > ok( $item->notforloan eq 9, q{UpdateNotForLoanStatusOnCheckin does not update notforloan value from 9 with setting "1: 9"} ); > >+my $itemnumber2; >+($biblionumber, $biblioitemnumber, $itemnumber2) = C4::Items::AddItem( >+ { >+ barcode => 'barcode_4', >+ itemcallnumber => 'callnumber4', >+ homebranch => $branchcode_1, >+ holdingbranch => $branchcode_1, >+ location => 'FIC', >+ itype => $itemtype >+ }, >+ $biblionumber >+); >+ >+t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', q{} ); >+AddReturn( 'barcode_4', $branchcode_1 ); >+my $item2 = Koha::Items->find( $itemnumber2 ); >+ok( $item2->location eq 'FIC', 'UpdateItemLocationOnCheckin does not modify value when not enabled' ); >+ >+t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' ); >+AddReturn( 'barcode_4', $branchcode_1 ); >+$item2 = Koha::Items->find( $itemnumber2 ); >+ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); >+ok( $item2->permanent_location eq 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); >+AddReturn( 'barcode_4', $branchcode_1 ); >+$item2 = Koha::Items->find( $itemnumber2 ); >+ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} ); >+ >+t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', '_ALL_: CART' ); >+AddReturn( 'barcode_4', $branchcode_1 ); >+$item2 = Koha::Items->find( $itemnumber2 ); >+ok( $item2->location eq 'CART', q{UpdateItemLocationOnCheckin updates location value from 'GEN' with setting "_ALL_: CART"} ); >+ok( $item2->permanent_location eq 'GEN', q{UpdateItemLocationOnCheckin does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} ); >+AddIssue( $borrower_1, 'barcode_4', $daysago10,0, $today, '' ); >+$item2 = Koha::Items->find( $itemnumber2 ); >+ok( $item2->location eq 'GEN', q{Location updates from 'CART' to permanent location on issue} ); >+ >+t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" ); >+AddReturn( 'barcode_4', $branchcode_1 ); >+$item2 = Koha::Items->find( $itemnumber2 ); >+ok( $item2->location eq '', q{UpdateItemLocationOnCheckin updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} ); >+AddReturn( 'barcode_4', $branchcode_1 ); >+$item2 = Koha::Items->find( $itemnumber2 ); >+ok( $item2->location eq 'PROC' , q{UpdateItemLocationOnCheckin updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); >+ok( $item2->permanent_location eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); >+AddReturn( 'barcode_4', $branchcode_1 ); >+$item2 = Koha::Items( $itemnumber2 ); >+ok( $item2->location eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } ); >+ok( $item2->permanent_location eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } ); >+ >+ >+ >+ > # Bug 14640 - Cancel the hold on checking out if asked > my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber, > undef, 1, undef, undef, "a note", "a title", undef, ''); >diff --git a/t/db_dependent/UsageStats.t b/t/db_dependent/UsageStats.t >index 9d11af1674..90b205b3d4 100644 >--- a/t/db_dependent/UsageStats.t >+++ b/t/db_dependent/UsageStats.t >@@ -397,7 +397,6 @@ sub mocking_systempreferences_to_a_set_value { > CircControl > HomeOrHoldingBranch > HomeOrHoldingBranchReturn >- InProcessingToShelvingCart > IssueLostItem > IssuingInProcess > ManInvInNoissuesCharge >@@ -406,7 +405,6 @@ sub mocking_systempreferences_to_a_set_value { > RenewalSendNotice > RentalsInNoissuesCharge > ReturnBeforeExpiry >- ReturnToShelvingCart > TransfersMaxDaysWarning > UseBranchTransferLimits > useDaysMode >-- >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 14576
:
46454
|
46455
|
46456
|
48258
|
48259
|
50662
|
50663
|
52195
|
52196
|
52197
|
52204
|
52205
|
52206
|
52222
|
52223
|
52224
|
52365
|
53112
|
53113
|
53114
|
53115
|
54281
|
54644
|
54645
|
54646
|
54647
|
54648
|
54654
|
55587
|
60658
|
60659
|
60660
|
60661
|
60662
|
60663
|
60747
|
60748
|
60751
|
61940
|
61941
|
61942
|
61944
|
61945
|
61946
|
61947
|
61948
|
61949
|
61950
|
64656
|
64657
|
64658
|
67610
|
67611
|
68297
|
70795
|
70796
|
70797
|
72032
|
72033
|
72034
|
75661
|
75662
|
75663
|
79245
|
79246
|
79995
|
79996
|
83113
|
83114
|
83115
|
83696
|
83697
|
83698
|
85406
|
85850
|
85851
|
85852
|
85853
|
86812
|
86813
|
86814
|
86815
|
86816
|
87040
|
87061
|
87144
|
87145
|
87146
|
87147
|
87148
|
87149
|
87150
|
87151
|
87925
|
88451
|
88452
|
88453
|
88454
|
88455
|
88456
|
88457
|
88458
|
88459
|
88646
|
88647
|
88648
|
88649
|
88650
|
88651
|
88652
|
88653
|
88654