Bugzilla – Attachment 182223 Details for
Bug 23010
If an item is checked out or in transit it should not be able to be marked withdrawn
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23010: More unit tests
Bug-23010-More-unit-tests.patch (text/plain), 4.19 KB, created by
Emily Lamancusa (emlam)
on 2025-05-09 17:50:59 UTC
(
hide
)
Description:
Bug 23010: More unit tests
Filename:
MIME Type:
Creator:
Emily Lamancusa (emlam)
Created:
2025-05-09 17:50:59 UTC
Size:
4.19 KB
patch
obsolete
>From 3df49889731eccab0bd81e829a1bad6c154ea77c Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Fri, 9 May 2025 16:56:34 +0000 >Subject: [PATCH] Bug 23010: More unit tests > >Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> >--- > t/db_dependent/Koha/Items/BatchUpdate.t | 67 ++++++++++++++++++++++--- > 1 file changed, 61 insertions(+), 6 deletions(-) > >diff --git a/t/db_dependent/Koha/Items/BatchUpdate.t b/t/db_dependent/Koha/Items/BatchUpdate.t >index 18f0304cf5..e3895459e5 100755 >--- a/t/db_dependent/Koha/Items/BatchUpdate.t >+++ b/t/db_dependent/Koha/Items/BatchUpdate.t >@@ -284,7 +284,7 @@ subtest 'mark_items_returned' => sub { > }; > > subtest 'report' => sub { >- plan tests => 5; >+ plan tests => 7; > > my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); > my $item_2 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); >@@ -297,7 +297,8 @@ subtest 'report' => sub { > $report, > { > modified_itemnumbers => [ $item_1->itemnumber, $item_2->itemnumber ], >- modified_fields => 2 >+ modified_fields => 2, >+ errors => [] > } > ); > >@@ -308,7 +309,8 @@ subtest 'report' => sub { > $report, > { > modified_itemnumbers => [ $item_1->itemnumber, $item_2->itemnumber ], >- modified_fields => 2 >+ modified_fields => 2, >+ errors => [] > } > ); > >@@ -320,7 +322,8 @@ subtest 'report' => sub { > $report, > { > modified_itemnumbers => [ $item_1->itemnumber ], >- modified_fields => 1 >+ modified_fields => 1, >+ errors => [] > } > ); > >@@ -331,7 +334,8 @@ subtest 'report' => sub { > $report, > { > modified_itemnumbers => [ $item_1->itemnumber, $item_2->itemnumber ], >- modified_fields => 4 >+ modified_fields => 4, >+ errors => [] > } > ); > >@@ -349,10 +353,61 @@ subtest 'report' => sub { > $report, > { > modified_itemnumbers => [ $item_1->itemnumber, $item_2->itemnumber ], >- modified_fields => 7 >+ modified_fields => 7, >+ errors => [] >+ } >+ ); >+ t::lib::Mocks::mock_preference( 'PreventWithDrawingItemsStatus', 'intransit,checkedout' ); >+ >+ $item_2->get_from_storage->update( { onloan => '2025-01-01' } ); >+ >+ local $SIG{__WARN__} = sub { }; >+ my ($report2) = $items->batch_update( { new_values => { withdrawn => 1 } } ); >+ >+ $items->reset; >+ >+ is_deeply( >+ $report2, >+ { >+ modified_itemnumbers => [ $item_1->itemnumber ], >+ modified_fields => 1, >+ errors => [ >+ { error => "Exception 'Koha::Exceptions::Item::Transfer::OnLoan' thrown 'onloan_cannot_withdraw'\n" } >+ ] > } > ); > >+ my $item_3 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); >+ my $item_4 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); >+ >+ Koha::Item::Transfer->new( >+ { >+ itemnumber => $item_3->itemnumber, >+ frombranch => $item_3->homebranch, >+ tobranch => $builder->build( { source => 'Branch' } )->{branchcode}, >+ datesent => '1999-01-01', >+ } >+ )->store; >+ >+ my $items2 = Koha::Items->search( { itemnumber => [ $item_3->itemnumber, $item_4->itemnumber ] } ); >+ >+ local $SIG{__WARN__} = sub { }; >+ my ($report3) = $items2->batch_update( { new_values => { withdrawn => 1 } } ); >+ >+ $items2->reset; >+ is_deeply( >+ $report3, >+ { >+ modified_itemnumbers => [ $item_4->itemnumber ], >+ modified_fields => 1, >+ errors => [ >+ { >+ error => >+ "Exception 'Koha::Exceptions::Item::Transfer::InTransit' thrown 'intransit_cannot_withdraw'\n" >+ } >+ ] >+ } >+ ); > }; > > Koha::Caches->get_instance->clear_from_cache("MarcStructure-1-"); >-- >2.34.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 23010
:
176241
|
177299
|
177402
|
177413
|
177434
|
177435
|
177436
|
177437
|
177451
|
177452
|
177453
|
177454
|
177911
|
177912
|
177913
|
177914
|
178808
|
181322
|
181323
|
181324
|
181325
|
181326
|
181327
|
181400
|
182124
|
182129
|
182130
|
182131
|
182201
|
182212
|
182213
|
182214
|
182215
|
182216
|
182217
|
182218
|
182219
|
182220
|
182221
|
182222
| 182223 |
182224