Bugzilla – Attachment 145151 Details for
Bug 32013
Autorenewals is effectively a bulk action and should be treated as such
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32013: (follow-up) Add unit test
Bug-32013-follow-up-Add-unit-test.patch (text/plain), 3.29 KB, created by
Nick Clemens (kidclamp)
on 2023-01-09 15:44:54 UTC
(
hide
)
Description:
Bug 32013: (follow-up) Add unit test
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-01-09 15:44:54 UTC
Size:
3.29 KB
patch
obsolete
>From 892f84812aab68039069e0f45f4cfb557e17e96c Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Wed, 7 Dec 2022 11:12:11 +0000 >Subject: [PATCH] Bug 32013: (follow-up) Add unit test > >A unit test has been added to show the pass-through of skip_record_index from AddRenewal() to the Item->store() method. > >Test plan: >1) In the shell run prove -vv t/db_dependent/Koha/SearchEngine/Indexer.t >2) Observe Subtest 3: Test AddRenewal indexer call >3) All four tests should pass > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > t/db_dependent/Koha/SearchEngine/Indexer.t | 50 +++++++++++++++++++++- > 1 file changed, 48 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha/SearchEngine/Indexer.t b/t/db_dependent/Koha/SearchEngine/Indexer.t >index 5dca8c7a77..726ac6c902 100755 >--- a/t/db_dependent/Koha/SearchEngine/Indexer.t >+++ b/t/db_dependent/Koha/SearchEngine/Indexer.t >@@ -4,7 +4,7 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; > use Test::Warn; > > use MARC::Field; >@@ -17,7 +17,7 @@ use t::lib::Mocks; > #use C4::Biblio qw//; > use C4::AuthoritiesMarc qw( AddAuthority DelAuthority merge ); > use C4::Biblio qw( ModZebra ModBiblio ModBiblioMarc DelBiblio ); >-use C4::Circulation qw( MarkIssueReturned AddReturn LostItem ); >+use C4::Circulation qw( MarkIssueReturned AddReturn LostItem AddRenewal ); > use C4::Items qw( ModDateLastSeen ModItemTransfer ); > use Koha::Database; > use Koha::SearchEngine::Elasticsearch; >@@ -246,4 +246,50 @@ subtest 'Test indexer calls' => sub { > > }; > >+subtest 'Test AddRenewal indexer call' => sub { >+ plan tests => 4; >+ >+ my @engines = ('Zebra'); >+ eval { Koha::SearchEngine::Elasticsearch->get_elasticsearch_params; }; >+ push @engines, 'Elasticsearch' unless $@; >+ SKIP: { >+ skip 'Elasticsearch configuration not available', 20 >+ if scalar @engines == 1; >+ } >+ >+ for my $engine ( @engines ){ >+ t::lib::Mocks::mock_preference( 'SearchEngine', $engine ); >+ my $mock_index = Test::MockModule->new("Koha::SearchEngine::".$engine."::Indexer"); >+ >+ $mock_index->mock( index_records => sub { >+ warn $engine; >+ my ($package, undef, undef) = caller; >+ warn $package; >+ }); >+ >+ my $biblio = $builder->build_sample_biblio(); >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $item = $builder->build_sample_item({ >+ biblionumber => $biblio->biblionumber, >+ onloan => '2020-02-02', >+ datelastseen => '2020-01-01', >+ replacementprice => 0 >+ }); >+ my $issue = $builder->build({ >+ source => 'Issue', >+ value => { >+ itemnumber => $item->itemnumber >+ } >+ }); >+ >+ warnings_are{ >+ AddRenewal($patron->borrowernumber, $item->itemnumber, $item->homebranch, undef, undef, undef, 0); >+ } [$engine,"Koha::Item"], "index_records is called for $engine when adding a renewal (AddRenewal())"; >+ warnings_are{ >+ AddRenewal($patron->borrowernumber, $item->itemnumber, undef, undef, undef, undef, 0, 1); >+ } undef, "index_records is not called for $engine when adding a renewal (AddRenewal()) with skip_record_index"; >+ >+ } >+}; >+ > $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 32013
:
144442
|
144464
|
145150
|
145151
|
145152
|
145186
|
145187
|
145188
|
149276
|
149277
|
149278
|
149279