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

(-)a/t/db_dependent/Koha/ILL/Request.t (-2 / +45 lines)
Lines 20-26 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::NoWarnings;
22
use Test::NoWarnings;
23
use Test::More tests => 8;
23
use Test::More tests => 9;
24
use Test::MockModule;
24
use Test::MockModule;
25
25
26
use Koha::ILL::Requests;
26
use Koha::ILL::Requests;
Lines 299-301 subtest 'add_or_update_attributes() tests' => sub { Link Here
299
299
300
    $schema->storage->txn_rollback;
300
    $schema->storage->txn_rollback;
301
};
301
};
302
- 
302
303
subtest 'auto_set_manager' => sub {
304
305
    plan tests => 2;
306
307
    $schema->storage->txn_begin;
308
309
    my $librarian = $builder->build_object(
310
        {
311
            class => 'Koha::Patrons',
312
            value => { flags => 2**22 }
313
        }
314
    );
315
    my $password = 'thePassword123';
316
    $librarian->set_password( { password => $password, skip_validation => 1 } );
317
318
    my $logger      = Koha::ILL::Request::Logger->new;
319
    my $ill_request = $builder->build_sample_ill_request( { managedby => undef } );
320
321
    t::lib::Mocks::mock_userenv( { patron => $librarian } );
322
    $logger->log_status_change(
323
        {
324
            request => $ill_request,
325
            value   => 'NEW'
326
        }
327
    );
328
329
    is( $librarian->borrowernumber, $ill_request->managedby, 'Managed by correctly set' );
330
331
    my $unauthorized_patron = $builder->build_object(
332
        {
333
            class => 'Koha::Patrons',
334
            value => { flags => 0 }
335
        }
336
    );
337
    my $unauth_password = 'thePassword123';
338
    $unauthorized_patron->set_password( { password => $unauth_password, skip_validation => 1 } );
339
    my $unauth_userid = $unauthorized_patron->userid;
340
    t::lib::Mocks::mock_userenv( { patron => $librarian } );
341
    my $no_manager_ill_request = $builder->build_sample_ill_request( { managedby => undef } );
342
    is( undef, $no_manager_ill_request->managedby, 'Managed by correctly undef' );
343
344
    $schema->storage->txn_rollback;
345
};

Return to bug 40504