Bugzilla – Attachment 134855 Details for
Bug 30727
Holds queue updates can be called multiple times on batch record deletion
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30727: Regression tests
Bug-30727-Regression-tests.patch (text/plain), 3.22 KB, created by
Martin Renvoize (ashimema)
on 2022-05-11 10:01:37 UTC
(
hide
)
Description:
Bug 30727: Regression tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-05-11 10:01:37 UTC
Size:
3.22 KB
patch
obsolete
>From 6085124dddd06a06e7b8ef0b5fe5a6ef7023f53e Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 10 May 2022 12:26:32 -0300 >Subject: [PATCH] Bug 30727: Regression tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../Koha/BackgroundJobs/BatchDeleteBiblio.t | 84 +++++++++++++++++++ > 1 file changed, 84 insertions(+) > create mode 100755 t/db_dependent/Koha/BackgroundJobs/BatchDeleteBiblio.t > >diff --git a/t/db_dependent/Koha/BackgroundJobs/BatchDeleteBiblio.t b/t/db_dependent/Koha/BackgroundJobs/BatchDeleteBiblio.t >new file mode 100755 >index 0000000000..b2d80491aa >--- /dev/null >+++ b/t/db_dependent/Koha/BackgroundJobs/BatchDeleteBiblio.t >@@ -0,0 +1,84 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Test::More tests => 1; >+use Test::MockModule; >+ >+use JSON qw( encode_json ); >+ >+use C4::Reserves qw(AddReserve); >+ >+use Koha::Database; >+use Koha::BackgroundJob::BatchDeleteBiblio; >+use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue; >+ >+use t::lib::TestBuilder; >+ >+my $schema = Koha::Database->new->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+subtest "process() tests" => sub { >+ >+ plan tests => 1; >+ >+ $schema->storage->txn_begin; >+ >+ my $biblio = $builder->build_sample_biblio; >+ my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->id }); >+ my $item_2 = $builder->build_sample_item({ biblionumber => $biblio->id }); >+ >+ my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ AddReserve( >+ { >+ borrowernumber => $patron->id, >+ biblionumber => $biblio->id, >+ itemnumber => $item_1->id, >+ branchcode => $patron->branchcode >+ } >+ ); >+ >+ my $counter = 0; >+ >+ my $mock_holds_queue_job = Test::MockModule->new('Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue'); >+ $mock_holds_queue_job->mock( 'enqueue', sub { >+ $counter++; >+ }); >+ >+ my $job = Koha::BackgroundJob::BatchDeleteBiblio->new( >+ { >+ status => 'new', >+ size => 1, >+ borrowernumber => undef, >+ type => 'batch_biblio_record_deletion', >+ data => encode_json { >+ record_ids => [ $biblio->id ], >+ } >+ } >+ ); >+ >+ $job->process( >+ { >+ record_ids => [ $biblio->id ], >+ } >+ ); >+ >+ is( $counter, 1, 'Holds queue update is enqueued only once' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.20.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 30727
:
134820
|
134821
|
134840
|
134841
| 134855 |
134856