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 3057-3078 subtest 'Koha::ItemType::calc_rental_charge_daily tests' => sub { Link Here
3057
    t::lib::Mocks::mock_preference('finesCalendar', 'ignoreCalendar');
3057
    t::lib::Mocks::mock_preference('finesCalendar', 'ignoreCalendar');
3058
    my $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3058
    my $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3059
    my $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3059
    my $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3060
    is( $accountline->amount, '7.000000', "Daily rental charge calulated correctly with finesCalendar = ignoreCalendar" );
3060
    is( $accountline->amount, '7.000000', "Daily rental charge calculated correctly with finesCalendar = ignoreCalendar" );
3061
    $accountline->delete();
3061
    $accountline->delete();
3062
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3062
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3063
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3063
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3064
    is( $accountline->amount, '6.000000', "Daily rental charge calulated correctly with finesCalendar = ignoreCalendar, for renewal" );
3064
    is( $accountline->amount, '6.000000', "Daily rental charge calculated correctly with finesCalendar = ignoreCalendar, for renewal" );
3065
    $accountline->delete();
3065
    $accountline->delete();
3066
    $issue->delete();
3066
    $issue->delete();
3067
3067
3068
    t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed');
3068
    t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed');
3069
    $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3069
    $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3070
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3070
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3071
    is( $accountline->amount, '7.000000', "Daily rental charge calulated correctly with finesCalendar = noFinesWhenClosed" );
3071
    is( $accountline->amount, '7.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed" );
3072
    $accountline->delete();
3072
    $accountline->delete();
3073
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3073
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3074
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3074
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3075
    is( $accountline->amount, '6.000000', "Daily rental charge calulated correctly with finesCalendar = noFinesWhenClosed, for renewal" );
3075
    is( $accountline->amount, '6.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed, for renewal" );
3076
    $accountline->delete();
3076
    $accountline->delete();
3077
    $issue->delete();
3077
    $issue->delete();
3078
3078
Lines 3084-3094 subtest 'Koha::ItemType::calc_rental_charge_daily tests' => sub { Link Here
3084
    );
3084
    );
3085
    $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3085
    $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3086
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3086
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3087
    is( $accountline->amount, '6.000000', "Daily rental charge calulated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays" );
3087
    is( $accountline->amount, '6.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays" );
3088
    $accountline->delete();
3088
    $accountline->delete();
3089
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3089
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3090
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3090
    $accountline = Koha::Account::Lines->find({ itemnumber => $item->id });
3091
    is( $accountline->amount, '5.000000', "Daily rental charge calulated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays, for renewal" );
3091
    is( $accountline->amount, '5.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays, for renewal" );
3092
    $accountline->delete();
3092
    $accountline->delete();
3093
    $issue->delete();
3093
    $issue->delete();
3094
3094
(-)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