Bugzilla – Attachment 181325 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: Add unit tests
Bug-23010-Add-unit-tests.patch (text/plain), 2.75 KB, created by
Lucas Gass (lukeg)
on 2025-04-22 22:27:22 UTC
(
hide
)
Description:
Bug 23010: Add unit tests
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-04-22 22:27:22 UTC
Size:
2.75 KB
patch
obsolete
>From e7917eca253b42083407de2013a57e0991d208c1 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Fri, 31 Jan 2025 21:15:44 +0000 >Subject: [PATCH] Bug 23010: Add unit tests > >Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> >--- > t/db_dependent/Koha/Item.t | 55 ++++++++++++++++++++++++++++++++++++-- > 1 file changed, 53 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index 06fe7af209b..ed48ce7dded 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -21,7 +21,7 @@ use Modern::Perl; > use utf8; > > use Test::NoWarnings; >-use Test::More tests => 39; >+use Test::More tests => 40; > use Test::Exception; > use Test::MockModule; > use Test::Warn; >@@ -46,12 +46,63 @@ use t::lib::Dates; > my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; > >+subtest 'store PreventWithDrawingItemsStatus' => sub { >+ plan tests => 2; >+ $schema->storage->txn_begin; >+ >+ t::lib::Mocks::mock_preference( 'PreventWithDrawingItemsStatus', 'intransit,checkedout' ); >+ my $library_1 = $builder->build( { source => 'Branch' } ); >+ my $library_2 = $builder->build( { source => 'Branch' } ); >+ >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ t::lib::Mocks::mock_userenv( { branchcode => $patron->branchcode } ); >+ >+ my $item = $builder->build_sample_item( >+ { >+ withdrawn => 0, >+ } >+ ); >+ >+ #Check item out >+ C4::Circulation::AddIssue( $patron, $item->barcode ); >+ >+ throws_ok { $item->withdrawn('1')->store } >+ 'Koha::Exceptions::Item::Transfer::OnLoan', >+ 'Exception thrown when trying to withdraw checked-out item'; >+ >+ my $item_2 = $builder->build_sample_item( >+ { >+ withdrawn => 0, >+ } >+ ); >+ >+ #set in_transit >+ my $transfer_1 = $builder->build_object( >+ { >+ class => 'Koha::Item::Transfers', >+ value => { >+ itemnumber => $item_2->itemnumber, >+ frombranch => $library_1->{branchcode}, >+ tobranch => $library_2->{branchcode}, >+ datesent => '1999-12-31', >+ } >+ } >+ ); >+ >+ throws_ok { $item_2->withdrawn('1')->store } >+ 'Koha::Exceptions::Item::Transfer::InTransit', >+ 'Exception thrown when trying to withdraw item in transit'; >+ >+ t::lib::Mocks::mock_preference( 'PreventWithDrawingItemsStatus', '' ); >+ >+ $schema->storage->txn_rollback; >+}; >+ > subtest 'z3950_status' => sub { > plan tests => 9; > > $schema->storage->txn_begin; > t::lib::Mocks::mock_preference( 'z3950Status', '' ); >- > my $itemtype = $builder->build_object( { class => "Koha::ItemTypes" } ); > my $item = $builder->build_sample_item( > { >-- >2.39.5
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