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

(-)a/t/db_dependent/Circulation.t (-7 / +7 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 119;
20
use Test::More tests => 120;
21
21
22
use Data::Dumper;
22
use Data::Dumper;
23
use DateTime;
23
use DateTime;
Lines 2504-2525 subtest 'Koha::ItemType::calc_rental_charge_daily tests' => sub { Link Here
2504
    t::lib::Mocks::mock_preference('finesCalendar', 'ignoreCalendar');
2504
    t::lib::Mocks::mock_preference('finesCalendar', 'ignoreCalendar');
2505
    my $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
2505
    my $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
2506
    my $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
2506
    my $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
2507
    is( $accountline->amount, '7.000000', "Daily rental charge calulated correctly with finesCalendar = ignoreCalendar" );
2507
    is( $accountline->amount, '7.000000', "Daily rental charge calculated correctly with finesCalendar = ignoreCalendar" );
2508
    $accountline->delete();
2508
    $accountline->delete();
2509
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
2509
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
2510
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
2510
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
2511
    is( $accountline->amount, '6.000000', "Daily rental charge calulated correctly with finesCalendar = ignoreCalendar, for renewal" );
2511
    is( $accountline->amount, '6.000000', "Daily rental charge calculated correctly with finesCalendar = ignoreCalendar, for renewal" );
2512
    $accountline->delete();
2512
    $accountline->delete();
2513
    $issue->delete();
2513
    $issue->delete();
2514
2514
2515
    t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed');
2515
    t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed');
2516
    $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
2516
    $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
2517
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
2517
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
2518
    is( $accountline->amount, '7.000000', "Daily rental charge calulated correctly with finesCalendar = noFinesWhenClosed" );
2518
    is( $accountline->amount, '7.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed" );
2519
    $accountline->delete();
2519
    $accountline->delete();
2520
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
2520
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
2521
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
2521
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
2522
    is( $accountline->amount, '6.000000', "Daily rental charge calulated correctly with finesCalendar = noFinesWhenClosed, for renewal" );
2522
    is( $accountline->amount, '6.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed, for renewal" );
2523
    $accountline->delete();
2523
    $accountline->delete();
2524
    $issue->delete();
2524
    $issue->delete();
2525
2525
Lines 2531-2541 subtest 'Koha::ItemType::calc_rental_charge_daily tests' => sub { Link Here
2531
    );
2531
    );
2532
    $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
2532
    $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
2533
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
2533
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
2534
    is( $accountline->amount, '6.000000', "Daily rental charge calulated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays" );
2534
    is( $accountline->amount, '6.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays" );
2535
    $accountline->delete();
2535
    $accountline->delete();
2536
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
2536
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
2537
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
2537
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
2538
    is( $accountline->amount, '5.000000', "Daily rental charge calulated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays, for renewal" );
2538
    is( $accountline->amount, '5.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays, for renewal" );
2539
    $accountline->delete();
2539
    $accountline->delete();
2540
    $issue->delete();
2540
    $issue->delete();
2541
2541
(-)a/t/db_dependent/Koha/ItemTypes.t (-4 / +3 lines)
Lines 171-181 subtest 'Koha::ItemType::calc_rental_charge_daily tests' => sub { Link Here
171
171
172
    t::lib::Mocks::mock_preference('finesCalendar', 'ignoreCalendar');
172
    t::lib::Mocks::mock_preference('finesCalendar', 'ignoreCalendar');
173
    my $charge = $itemtype->calc_rental_charge_daily( { from => $dt_from, to => $dt_to } );
173
    my $charge = $itemtype->calc_rental_charge_daily( { from => $dt_from, to => $dt_to } );
174
    is( $charge, 7.00, "Daily rental charge calulated correctly with finesCalendar = ignoreCalendar" );
174
    is( $charge, 7.00, "Daily rental charge calculated correctly with finesCalendar = ignoreCalendar" );
175
175
176
    t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed');
176
    t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed');
177
    $charge = $itemtype->calc_rental_charge_daily( { from => $dt_from, to => $dt_to } );
177
    $charge = $itemtype->calc_rental_charge_daily( { from => $dt_from, to => $dt_to } );
178
    is( $charge, 7.00, "Daily rental charge calulated correctly with finesCalendar = noFinesWhenClosed" );
178
    is( $charge, 7.00, "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed" );
179
179
180
    my $calendar = C4::Calendar->new( branchcode => $library->id );
180
    my $calendar = C4::Calendar->new( branchcode => $library->id );
181
    $calendar->insert_week_day_holiday(
181
    $calendar->insert_week_day_holiday(
Lines 184-190 subtest 'Koha::ItemType::calc_rental_charge_daily tests' => sub { Link Here
184
        description => 'Test holiday'
184
        description => 'Test holiday'
185
    );
185
    );
186
    $charge = $itemtype->calc_rental_charge_daily( { from => $dt_from, to => $dt_to } );
186
    $charge = $itemtype->calc_rental_charge_daily( { from => $dt_from, to => $dt_to } );
187
    is( $charge, 6.00, "Daily rental charge calulated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays" );
187
    is( $charge, 6.00, "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays" );
188
188
189
};
189
};
190
190
191
- 

Return to bug 20912