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

(-)a/t/db_dependent/Circulation.t (-7 / +7 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 => 124;
21
use Test::More tests => 125;
22
use Test::MockModule;
22
use Test::MockModule;
23
23
24
use Data::Dumper;
24
use Data::Dumper;
Lines 3044-3065 subtest 'Koha::ItemType::calc_rental_charge_daily tests' => sub { Link Here
3044
    t::lib::Mocks::mock_preference('finesCalendar', 'ignoreCalendar');
3044
    t::lib::Mocks::mock_preference('finesCalendar', 'ignoreCalendar');
3045
    my $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3045
    my $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3046
    my $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3046
    my $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3047
    is( $accountline->amount, '7.000000', "Daily rental charge calulated correctly with finesCalendar = ignoreCalendar" );
3047
    is( $accountline->amount, '7.000000', "Daily rental charge calculated correctly with finesCalendar = ignoreCalendar" );
3048
    $accountline->delete();
3048
    $accountline->delete();
3049
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3049
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3050
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3050
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3051
    is( $accountline->amount, '6.000000', "Daily rental charge calulated correctly with finesCalendar = ignoreCalendar, for renewal" );
3051
    is( $accountline->amount, '6.000000', "Daily rental charge calculated correctly with finesCalendar = ignoreCalendar, for renewal" );
3052
    $accountline->delete();
3052
    $accountline->delete();
3053
    $issue->delete();
3053
    $issue->delete();
3054
3054
3055
    t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed');
3055
    t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed');
3056
    $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3056
    $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3057
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3057
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3058
    is( $accountline->amount, '7.000000', "Daily rental charge calulated correctly with finesCalendar = noFinesWhenClosed" );
3058
    is( $accountline->amount, '7.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed" );
3059
    $accountline->delete();
3059
    $accountline->delete();
3060
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3060
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3061
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3061
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3062
    is( $accountline->amount, '6.000000', "Daily rental charge calulated correctly with finesCalendar = noFinesWhenClosed, for renewal" );
3062
    is( $accountline->amount, '6.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed, for renewal" );
3063
    $accountline->delete();
3063
    $accountline->delete();
3064
    $issue->delete();
3064
    $issue->delete();
3065
3065
Lines 3071-3081 subtest 'Koha::ItemType::calc_rental_charge_daily tests' => sub { Link Here
3071
    );
3071
    );
3072
    $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3072
    $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3073
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3073
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3074
    is( $accountline->amount, '6.000000', "Daily rental charge calulated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays" );
3074
    is( $accountline->amount, '6.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays" );
3075
    $accountline->delete();
3075
    $accountline->delete();
3076
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3076
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3077
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3077
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3078
    is( $accountline->amount, '5.000000', "Daily rental charge calulated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays, for renewal" );
3078
    is( $accountline->amount, '5.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays, for renewal" );
3079
    $accountline->delete();
3079
    $accountline->delete();
3080
    $issue->delete();
3080
    $issue->delete();
3081
3081
(-)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