View | Details | Raw Unified | Return to bug 40943
Collapse All | Expand All

(-)a/Koha/BackgroundJob.pm (+3 lines)
Lines 125-130 sub enqueue { Link Here
125
    my $job_queue   = $params->{job_queue}   // 'default';
125
    my $job_queue   = $params->{job_queue}   // 'default';
126
    my $json        = $self->json;
126
    my $json        = $self->json;
127
127
128
    # session_id must not be logged
129
    delete $job_context->{session_id};
130
128
    my $borrowernumber = ( C4::Context->userenv ) ? C4::Context->userenv->{number} : undef;
131
    my $borrowernumber = ( C4::Context->userenv ) ? C4::Context->userenv->{number} : undef;
129
    $job_context->{interface} = C4::Context->interface;
132
    $job_context->{interface} = C4::Context->interface;
130
    my $json_context = $json->encode($job_context);
133
    my $json_context = $json->encode($job_context);
(-)a/t/db_dependent/Koha/BackgroundJob.t (-3 / +8 lines)
Lines 119-125 subtest 'enqueue() tests' => sub { Link Here
119
        shibboleth    => undef,
119
        shibboleth    => undef,
120
        desk_id       => undef,
120
        desk_id       => undef,
121
        desk_name     => undef,
121
        desk_name     => undef,
122
        interface     => $interface
122
        interface     => $interface,
123
124
        # session_id must not be logged!
123
    };
125
    };
124
126
125
    $job_id = Koha::BackgroundJob::BatchUpdateItem->new->enqueue( { record_ids => [ 1, 2, 3 ] } );
127
    $job_id = Koha::BackgroundJob::BatchUpdateItem->new->enqueue( { record_ids => [ 1, 2, 3 ] } );
Lines 218-223 subtest 'process tests' => sub { Link Here
218
        shibboleth    => undef,
220
        shibboleth    => undef,
219
        desk_id       => undef,
221
        desk_id       => undef,
220
        desk_name     => undef,
222
        desk_name     => undef,
223
224
        # session_id must not be logged!
221
    };
225
    };
222
226
223
    my $background_job_module = Test::MockModule->new('Koha::BackgroundJob');
227
    my $background_job_module = Test::MockModule->new('Koha::BackgroundJob');
Lines 237-243 subtest 'process tests' => sub { Link Here
237
    is( C4::Context->interface, 'opac', "Interface set to opac prior to calling process" );
241
    is( C4::Context->interface, 'opac', "Interface set to opac prior to calling process" );
238
242
239
    $job->process();
243
    $job->process();
240
    is_deeply( C4::Context->userenv,   $job_context, "Userenv set from job context on process" );
244
    my $expected_context = C4::Context->userenv;
245
    delete $expected_context->{session_id};
246
    is_deeply( $expected_context,      $job_context, "Userenv set from job context on process" );
241
    is_deeply( C4::Context->interface, 'intranet',   "Interface set from job context on process" );
247
    is_deeply( C4::Context->interface, 'intranet',   "Interface set from job context on process" );
242
248
243
    # Manually add a job (->new->store) without context
249
    # Manually add a job (->new->store) without context
244
- 

Return to bug 40943