Bugzilla – Attachment 177437 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.65 KB, created by
Lucas Gass (lukeg)
on 2025-01-31 22:24:59 UTC
(
hide
)
Description:
Bug 23010: Add unit tests
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-01-31 22:24:59 UTC
Size:
2.65 KB
patch
obsolete
>From 201b4b4af9207f378bdadf17d605814983dd0645 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 > >--- > t/db_dependent/Koha/Item.t | 51 ++++++++++++++++++++++++++++++++++++-- > 1 file changed, 49 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index 7d115cdb3ab..4fd9ce78d4b 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 => 38; >+use Test::More tests => 39; > use Test::Exception; > use Test::MockModule; > use Test::Warn; >@@ -45,12 +45,59 @@ 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