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

(-)a/t/db_dependent/Circulation.t (-2 / +44 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
use utf8;
19
use utf8;
20
20
21
use Test::More tests => 74;
21
use Test::More tests => 75;
22
use Test::Exception;
22
use Test::Exception;
23
use Test::MockModule;
23
use Test::MockModule;
24
use Test::Deep qw( cmp_deeply );
24
use Test::Deep qw( cmp_deeply );
Lines 293-298 Koha::CirculationRules->set_rules( Link Here
293
    }
293
    }
294
);
294
);
295
295
296
subtest 'AddIssue | renewal when adding issue to same borrower' => sub {
297
    plan tests => 2;
298
299
    my $item = $builder->build_sample_item();
300
301
    # Set a simple circ policy
302
    Koha::CirculationRules->set_rules(
303
        {
304
            categorycode => undef,
305
            branchcode   => undef,
306
            itemtype     => $item->itype,
307
            rules        => {
308
                maxissueqty     => 1,
309
                reservesallowed => 25,
310
                issuelength     => 7,
311
                lengthunit      => 'days',
312
                renewalsallowed => 5,
313
                renewalperiod   => 7,
314
                norenewalbefore => undef,
315
                auto_renew      => 0,
316
                fine            => .10,
317
                chargeperiod    => 1,
318
            }
319
        }
320
    );
321
322
    my $now           = dt_from_string()->truncate( to => 'day' );
323
    my $seven_days    = $now->clone->add( days => 7 )->truncate( to => 'day' );
324
    my $fourteen_days = $now->clone->add( days => 14 )->truncate( to => 'day' );
325
    my $patron        = $builder->build_object( { class => 'Koha::Patrons' } );
326
    my $staff         = $builder->build_object( { class => "Koha::Patrons" } );
327
    t::lib::Mocks::mock_userenv( { patron => $staff } );
328
329
    my $issue = AddIssue( $patron, $item->barcode );
330
    is( dt_from_string( $issue->date_due )->truncate( to => 'day' ), $seven_days, "Item issued for correct term" );
331
    $issue = AddIssue( $patron, $item->barcode );
332
    is(
333
        dt_from_string( $issue->date_due )->truncate( to => 'day' ), $fourteen_days,
334
        "Second issue renews item for correct term"
335
    );
336
337
};
338
296
subtest "CanBookBeRenewed AllowRenewalIfOtherItemsAvailable multiple borrowers and items tests" => sub {
339
subtest "CanBookBeRenewed AllowRenewalIfOtherItemsAvailable multiple borrowers and items tests" => sub {
297
    plan tests => 7;
340
    plan tests => 7;
298
341
299
- 

Return to bug 37016