Bugzilla – Attachment 132074 Details for
Bug 30345
Koha::BackgroundJob->enqueue should set borrowernumber=undef if no userenv
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30345: Regression tests
Bug-30345-Regression-tests.patch (text/plain), 2.04 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-03-23 18:52:45 UTC
(
hide
)
Description:
Bug 30345: Regression tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-03-23 18:52:45 UTC
Size:
2.04 KB
patch
obsolete
>From 74f2f5d47c94aca7f295c9180fff527ea278e312 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 23 Mar 2022 15:47:24 -0300 >Subject: [PATCH] Bug 30345: Regression tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/BackgroundJob.t | 31 ++++++++++++++++++++++++++++- > 1 file changed, 30 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/BackgroundJob.t b/t/db_dependent/Koha/BackgroundJob.t >index 7dcabcbcda..632a615483 100755 >--- a/t/db_dependent/Koha/BackgroundJob.t >+++ b/t/db_dependent/Koha/BackgroundJob.t >@@ -17,11 +17,13 @@ > > use Modern::Perl; > >-use Test::More tests => 1; >+use Test::More tests => 2; > > use Koha::Database; > use Koha::BackgroundJobs; >+use Koha::BackgroundJob::BatchUpdateItem; > >+use t::lib::Mocks; > use t::lib::TestBuilder; > > my $schema = Koha::Database->new->schema; >@@ -56,3 +58,30 @@ subtest '_derived_class() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'enqueue() tests' => sub { >+ >+ plan tests => 6; >+ >+ $schema->storage->txn_begin; >+ >+ # FIXME: This all feels we need to do it better... >+ my $job_id = Koha::BackgroundJob::BatchUpdateItem->new->enqueue( { record_ids => [ 1, 2 ] } ); >+ my $job = Koha::BackgroundJobs->find($job_id)->_derived_class; >+ >+ is( $job->size, 2, 'Two steps' ); >+ is( $job->status, 'new', 'Initial status set correctly' ); >+ is( $job->borrowernumber, undef, 'No userenv, borrowernumber undef' ); >+ >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ t::lib::Mocks::mock_userenv( { patron => $patron } ); >+ >+ $job_id = Koha::BackgroundJob::BatchUpdateItem->new->enqueue( { record_ids => [ 1, 2, 3 ] } ); >+ $job = Koha::BackgroundJobs->find($job_id)->_derived_class; >+ >+ is( $job->size, 3, 'Three steps' ); >+ is( $job->status, 'new', 'Initial status set correctly' ); >+ is( $job->borrowernumber, $patron->id, 'No userenv, borrowernumber undef' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.35.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 30345
:
132074
|
132075
|
132243
|
132244
|
132824
|
132825
|
132851
|
132852
|
132853