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

(-)a/t/db_dependent/Koha/Charges/Fees.t (-8 / +23 lines)
Lines 61-72 my $itemtype = $builder->build_object( Link Here
61
    {
61
    {
62
        class => 'Koha::ItemTypes',
62
        class => 'Koha::ItemTypes',
63
        value => {
63
        value => {
64
            rentalcharge_daily  => '0.00',
64
            rentalcharge_daily           => '0.00',
65
            rentalcharge_hourly => '0.00',
65
            rentalcharge_daily_calendar  => 1,
66
            rentalcharge        => '0.00',
66
            rentalcharge_hourly          => '0.00',
67
            processfee          => '0.00',
67
            rentalcharge_hourly_calendar => 1,
68
            defaultreplacecost  => '0.00',
68
            rentalcharge                 => '0.00',
69
        },
69
            processfee                   => '0.00',
70
            defaultreplacecost           => '0.00',
71
          },
70
    }
72
    }
71
);
73
);
72
my $item = $builder->build_object(
74
my $item = $builder->build_object(
Lines 307-313 subtest 'from_date accessor' => sub { Link Here
307
};
309
};
308
310
309
subtest 'accumulate_rentalcharge tests' => sub {
311
subtest 'accumulate_rentalcharge tests' => sub {
310
    plan tests => 7;
312
    plan tests => 9;
311
313
312
    my $fees = Koha::Charges::Fees->new(
314
    my $fees = Koha::Charges::Fees->new(
313
        {
315
        {
Lines 347-352 subtest 'accumulate_rentalcharge tests' => sub { Link Here
347
'Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed'
349
'Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed'
348
    );
350
    );
349
351
352
    $itemtype->rentalcharge_daily_calendar(0)->store();
353
    $charge = $fees->accumulate_rentalcharge();
354
    is( $charge, 6.00,
355
'Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and rentalcharge_daily_calendar = 0'
356
    );
357
    $itemtype->rentalcharge_daily_calendar(1)->store();
358
350
    my $calendar = C4::Calendar->new( branchcode => $library->id );
359
    my $calendar = C4::Calendar->new( branchcode => $library->id );
351
    # DateTime 1..7 (Mon..Sun), C4::Calender 0..6 (Sun..Sat)
360
    # DateTime 1..7 (Mon..Sun), C4::Calender 0..6 (Sun..Sat)
352
    my $closed_day =
361
    my $closed_day =
Lines 409-414 subtest 'accumulate_rentalcharge tests' => sub { Link Here
409
"Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $dayname (96h - 24h * 0.25u)"
418
"Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $dayname (96h - 24h * 0.25u)"
410
    );
419
    );
411
420
421
    $itemtype->rentalcharge_hourly_calendar(0)->store();
422
    $charge = $fees->accumulate_rentalcharge();
423
    is( $charge, 24.00,
424
"Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $dayname (96h - 24h * 0.25u) and rentalcharge_hourly_calendar = 0"
425
    );
426
    $itemtype->rentalcharge_hourly_calendar(1)->store();
427
412
    $calendar->delete_holiday( weekday => $closed_day );
428
    $calendar->delete_holiday( weekday => $closed_day );
413
    $charge = $fees->accumulate_rentalcharge();
429
    $charge = $fees->accumulate_rentalcharge();
414
    is( $charge, 24.00, 'Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed (96h - 0h * 0.25u)' );
430
    is( $charge, 24.00, 'Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed (96h - 0h * 0.25u)' );
415
- 

Return to bug 21443