Bugzilla – Attachment 158522 Details for
Bug 21159
Update item shelving location (952$c) on checkout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21159: Add Koha::Item->update_item_location tests
Bug-21159-Add-KohaItem-updateitemlocation-tests.patch (text/plain), 2.83 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-11-06 14:03:51 UTC
(
hide
)
Description:
Bug 21159: Add Koha::Item->update_item_location tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-11-06 14:03:51 UTC
Size:
2.83 KB
patch
obsolete
>From 120c9e4d5b39d18acdf997a8ce9bdaa8e5bf6e7b Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 6 Nov 2023 11:00:04 -0300 >Subject: [PATCH] Bug 21159: Add Koha::Item->update_item_location tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Item.t | 63 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 62 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index 129f63cea4b..fdce202767b 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -20,7 +20,7 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 30; >+use Test::More tests => 31; > use Test::Exception; > use Test::MockModule; > >@@ -2301,3 +2301,64 @@ subtest 'current_branchtransfers relationship' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'update_item_location() tests' => sub { >+ >+ plan tests => 10; >+ >+ $schema->storage->txn_begin; >+ >+ my $location = 'YA'; >+ my $permanent_location = 'HEY'; >+ >+ foreach my $action (qw{ checkin checkout }) { >+ >+ my $pref = $action eq 'checkin' ? 'UpdateItemLocationOnCheckin' : 'UpdateItemLocationOnCheckout'; >+ >+ t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', q{} ); >+ t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', q{} ); >+ >+ my $item = $builder->build_sample_item( { location => $location, permanent_location => $permanent_location } ); >+ >+ $item->update_item_location($action); >+ >+ is( $item->location, $location, "$pref does not modify value when not enabled" ); >+ >+ t::lib::Mocks::mock_preference( $pref, qq{$location: GEN} ); >+ >+ $item->update_item_location($action); >+ >+ is( $item->location, 'GEN', qq{'location' value set from '$location' to 'GEN' with setting `$location: GEN`} ); >+ >+ t::lib::Mocks::mock_preference( $pref, q{_ALL_: BOO} ); >+ >+ $item->update_item_location($action); >+ >+ is( $item->location, 'BOO', q{`_ALL_` does the job} ); >+ >+ t::lib::Mocks::mock_preference( $pref, qq{$location: _BLANK_} ); >+ $item->location($location)->store(); >+ >+ $item->update_item_location($action); >+ is( $item->location, q{}, q{`_BLANK_` does the job} ); >+ >+ t::lib::Mocks::mock_preference( $pref, qq{GEN: _BLANK_\n_BLANK_: PROC\n$location: _PERM_} ); >+ >+ $item->set( >+ { >+ location => $location, >+ permanent_location => >+ $permanent_location, # setting `permanent_location` explicitly because ->store messes with it. >+ } >+ )->store; >+ >+ $item->update_item_location($action); >+ >+ is( >+ $item->location, $permanent_location, >+ q{_PERM_ does the job"} >+ ); >+ } >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.42.1
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 21159
:
77487
|
77549
|
77594
|
77775
|
77859
|
77869
|
77870
|
77871
|
80892
|
80893
|
80894
|
80895
|
87037
|
87038
|
87041
|
87693
|
87694
|
87695
|
139097
|
139098
|
139099
|
139103
|
139104
|
139105
|
139106
|
139107
|
139108
|
139109
|
139220
|
146602
|
146603
|
146604
|
146605
|
146606
|
146607
|
146608
|
154147
|
154148
|
154149
|
154150
|
154151
|
154152
|
155284
|
155285
|
155771
|
155772
|
155773
|
155774
|
158146
|
158147
|
158149
|
158150
|
158169
|
158170
|
158171
|
158172
|
158173
|
158521
| 158522