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

(-)a/t/db_dependent/Circulation/CalcDateDue.t (-2 / +38 lines)
Lines 2-8 Link Here
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
4
5
use Test::More tests => 17;
5
use Test::More tests => 19;
6
use Test::MockModule;
6
use Test::MockModule;
7
use DBI;
7
use DBI;
8
use DateTime;
8
use DateTime;
Lines 303-307 $calendar->delete_holiday( Link Here
303
    weekday => 6
303
    weekday => 6
304
);
304
);
305
305
306
# Renewal period of 0 is valid
307
Koha::CirculationRules->search()->delete();
308
Koha::CirculationRules->set_rules(
309
    {
310
        categorycode => undef,
311
        itemtype     => undef,
312
        branchcode   => undef,
313
        rules        => {
314
            issuelength   => 9999,
315
            renewalperiod => 0,
316
            lengthunit    => 'days',
317
            daysmode      => 'Days',
318
        }
319
    }
320
);
321
$date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower, 1 );
322
is( $date->ymd, $start_date->ymd, "Dates should match for renewalperiod of 0" );
323
324
# Renewal period of "" should trigger fallover to issuelength for renewal
325
Koha::CirculationRules->search()->delete();
326
Koha::CirculationRules->set_rules(
327
    {
328
        categorycode => undef,
329
        itemtype     => undef,
330
        branchcode   => undef,
331
        rules        => {
332
            issuelength   => 7,
333
            renewalperiod => q{},
334
            lengthunit    => 'days',
335
            daysmode      => 'Days',
336
        }
337
    }
338
);
339
my $renewed_date = $start_date->clone->add( days => 7 );
340
$date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower, 1 );
341
is( $date->ymd, $renewed_date->ymd, 'Renewal period of "" should trigger fallover to issuelength for renewal' );
342
306
$cache->clear_from_cache($key);
343
$cache->clear_from_cache($key);
307
$schema->storage->txn_rollback;
344
$schema->storage->txn_rollback;
308
- 

Return to bug 31120