Bugzilla – Attachment 154957 Details for
Bug 34656
CartToShelf should not trigger RealTimeHoldsQueue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34656: Unit test
Bug-34656-Unit-test.patch (text/plain), 2.28 KB, created by
Nick Clemens (kidclamp)
on 2023-08-30 13:52:30 UTC
(
hide
)
Description:
Bug 34656: Unit test
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-08-30 13:52:30 UTC
Size:
2.28 KB
patch
obsolete
>From 6ae25e03431bb75d3b691e4890639f0fcaef14d6 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 30 Aug 2023 13:46:17 +0000 >Subject: [PATCH] Bug 34656: Unit test > >--- > t/db_dependent/Items.t | 37 +++++++++++++++++++++++++++++++++++-- > 1 file changed, 35 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index 8dec62ca20..1fffe052dc 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -19,9 +19,10 @@ use Modern::Perl; > use Data::Dumper; > > use MARC::Record; >-use C4::Items qw( ModItemTransfer SearchItems AddItemFromMarc ModItemFromMarc get_hostitemnumbers_of Item2Marc ModDateLastSeen ); >+use C4::Items qw( ModItemTransfer SearchItems AddItemFromMarc ModItemFromMarc get_hostitemnumbers_of Item2Marc ModDateLastSeen CartToShelf ); > use C4::Biblio qw( GetMarcFromKohaField AddBiblio ); > use C4::Circulation qw( AddIssue ); >+use Koha::BackgroundJobs; > use Koha::Items; > use Koha::Database; > use Koha::DateUtils qw( dt_from_string ); >@@ -34,7 +35,7 @@ use Koha::AuthorisedValues; > use t::lib::Mocks; > use t::lib::TestBuilder; > >-use Test::More tests => 12; >+use Test::More tests => 13; > > use Test::Warn; > >@@ -972,3 +973,35 @@ subtest 'ModDateLastSeen' => sub { > is( $item->itemlost, 0, "Item no longer lost when no parameter is passed"); > is( $logs_after, $logs_before + 1, "ModDateLastSeen logs if item was lost and now found"); > }; >+ >+subtest 'CartToShelf test' => sub { >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ my $dbh = C4::Context->dbh; >+ my $builder = t::lib::TestBuilder->new; >+ >+ my $item = $builder->build_sample_item(); >+ >+ $item->permanent_location('BANANA')->location('CART')->store(); >+ >+ CartToShelf( $item->id ); >+ >+ $item->discard_changes; >+ >+ is( $item->location, 'BANANA', 'Item is correctly returned to permanent location'); >+ >+ >+ my $mock_RTHQ = Test::MockModule->new("Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue"); >+ $mock_RTHQ->mock( enqueue => sub { warn "RTHQ" } ); >+ t::lib::Mocks::mock_preference('RealTimeHoldsQueue', '1'); >+ >+ $item->location('CART')->store({ skip_holds_queue => 1 }); >+ warnings_are{ >+ CartToShelf( $item->id ); >+ } [], 'No RTHQ update triggered by CartToShelf'; >+ >+ $schema->storage->txn_rollback; >+ >+}; >+ >-- >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 34656
:
154957
|
154958
|
155011
|
155012
|
155013
|
155207
|
155208
|
155209