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

(-)a/t/db_dependent/Koha/Patron.t (-2 / +37 lines)
Lines 3176-3182 subtest 'ill_requests() tests' => sub { Link Here
3176
3176
3177
subtest 'can_place_holds() tests' => sub {
3177
subtest 'can_place_holds() tests' => sub {
3178
3178
3179
    plan tests => 7;
3179
    plan tests => 8;
3180
3180
3181
    subtest "'expired' tests" => sub {
3181
    subtest "'expired' tests" => sub {
3182
3182
Lines 3344-3349 subtest 'can_place_holds() tests' => sub { Link Here
3344
        $schema->storage->txn_rollback;
3344
        $schema->storage->txn_rollback;
3345
    };
3345
    };
3346
3346
3347
    subtest "'overdues' tests" => sub {
3348
3349
        plan tests => 4;
3350
3351
        $schema->storage->txn_begin;
3352
3353
        # Add a patron, making sure it is not (yet) expired
3354
        my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
3355
3356
        # Add an overdue issue
3357
        my $item = $builder->build_sample_item;
3358
        my $ago  = dt_from_string->subtract( days => 2 );
3359
        $builder->build_object(
3360
            {
3361
                class => 'Koha::Checkouts',
3362
                value =>
3363
                    { borrowernumber => $patron->borrowernumber, itemnumber => $item->itemnumber, date_due => $ago }
3364
            }
3365
        );
3366
3367
        t::lib::Mocks::mock_preference( 'OverduesBlockHolds', 'noblock' );
3368
3369
        ok( $patron->can_place_holds(), "Has overdues, can place holds" );
3370
3371
        t::lib::Mocks::mock_preference( 'OverduesBlockHolds', 'block' );
3372
3373
        my $result = $patron->can_place_holds();
3374
        ok( !$result, 'Has overdues, cannot place holds' );
3375
3376
        my $messages = $result->messages();
3377
        is( $messages->[0]->type,    'error' );
3378
        is( $messages->[0]->message, 'overdues' );
3379
3380
        $schema->storage->txn_rollback;
3381
    };
3382
3347
    subtest "'no_short_circuit' tests" => sub {
3383
    subtest "'no_short_circuit' tests" => sub {
3348
3384
3349
        plan tests => 9;
3385
        plan tests => 9;
3350
- 

Return to bug 41960