Bugzilla – Attachment 132556 Details for
Bug 20517
Use the "sort bin" field in SIP2 Checkin Response
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20517: Add unit tests
Bug-20517-Add-unit-tests.patch (text/plain), 3.16 KB, created by
Nick Clemens (kidclamp)
on 2022-03-30 11:12:25 UTC
(
hide
)
Description:
Bug 20517: Add unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-03-30 11:12:25 UTC
Size:
3.16 KB
patch
obsolete
>From e229d3294f07c91792435a75d24d935bb8af3961 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 27 Jan 2022 09:49:23 +0000 >Subject: [PATCH] Bug 20517: Add unit tests > >This patch adds some unit tests for the new _get_sort_bin function. > >We're testing that rules are applied in order and that the different >comparison operators work as expected. > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > t/db_dependent/SIP/Transaction.t | 54 +++++++++++++++++++++++++++++++- > 1 file changed, 53 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t >index 1f8cab65f2..d0763f8a64 100755 >--- a/t/db_dependent/SIP/Transaction.t >+++ b/t/db_dependent/SIP/Transaction.t >@@ -4,7 +4,7 @@ > # Current state is very rudimentary. Please help to extend it! > > use Modern::Perl; >-use Test::More tests => 12; >+use Test::More tests => 13; > > use Koha::Database; > use t::lib::TestBuilder; >@@ -524,6 +524,58 @@ subtest checkin_withdrawn => sub { > is( $circ->{screen_msg}, 'Item not checked out', "Got 'Item not checked out' screen message" ); > }; > >+subtest _get_sort_bin => sub { >+ plan tests => 4; >+ >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $branch = $library->branchcode; >+ my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $branch2 = $library2->branchcode; >+ >+ my $rules = <<"RULES"; >+$branch:homebranch:ne:\$holdingbranch:X\r >+$branch:effective_itemtype:eq:CD:0\r >+$branch:itemcallnumber:<:340:1\r >+$branch:itemcallnumber:<:370:2\r >+$branch:itemcallnumber:<:600:3\r >+$branch2:homebranch:ne:\$holdingbranch:X\r >+$branch2:effective_itemtype:eq:CD:4\r >+$branch2:itemcallnumber:>:600:5\r >+RULES >+ t::lib::Mocks::mock_preference('SIP2SortBinMapping', $rules); >+ >+ my $item_cd = $builder->build_sample_item( >+ { >+ library => $library->branchcode, >+ itype => 'CD' >+ } >+ ); >+ >+ my $item_book = $builder->build_sample_item( >+ { >+ library => $library->branchcode, >+ itype => 'BOOK', >+ itemcallnumber => '200.01' >+ } >+ ); >+ >+ my $bin; >+ >+ # Set holdingbranch as though item returned to library other than homebranch (As AddReturn would) >+ $item_cd->holdingbranch($library2->branchcode)->store(); >+ $bin = C4::SIP::ILS::Transaction::Checkin::_get_sort_bin( $item_cd, $library2->branchcode ); >+ is($bin, 'X', "Item parameter on RHS of comparison works (ne comparitor)"); >+ >+ # Reset holdingbranch as though item returned to home library >+ $item_cd->holdingbranch($library->branchcode)->store(); >+ $bin = C4::SIP::ILS::Transaction::Checkin::_get_sort_bin( $item_cd, $library->branchcode ); >+ is($bin, '0', "Fixed value on RHS of comparison works (eq comparitor)"); >+ $bin = C4::SIP::ILS::Transaction::Checkin::_get_sort_bin( $item_book, $library->branchcode ); >+ is($bin, '1', "Rules applied in order (< comparitor)"); >+ $item_book->itemcallnumber('350.20')->store(); >+ is($bin, '2', "Rules applied in order (< comparitor)"); >+}; >+ > subtest item_circulation_status => sub { > plan tests => 7; > >-- >2.30.2
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 20517
:
75126
|
75369
|
103689
|
106291
|
129846
|
129847
|
129848
|
129849
|
129850
|
129851
|
129852
|
129853
|
129854
|
129855
|
132555
|
132556
|
132557
|
132558
|
132559
|
132591
|
132592
|
132593
|
132594
|
132595
|
132596