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

(-)a/t/db_dependent/Circulation/CalcFine.t (-2 / +45 lines)
Lines 2-8 Link Here
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
4
5
use Test::More tests => 2;
5
use Test::More tests => 3;
6
6
7
use C4::Context;
7
use C4::Context;
8
use C4::Overdues;
8
use C4::Overdues;
Lines 169-174 subtest 'Test cap_fine_to_replacement_price' => sub { Link Here
169
    teardown();
169
    teardown();
170
};
170
};
171
171
172
subtest 'Test cap_fine_to_replacement_pricew with overduefinescap' => sub {
173
    plan tests => 2;
174
175
    t::lib::Mocks::mock_preference('useDefaultReplacementCost', '1');
176
    my $issuingrule = $builder->build_object(
177
        {
178
            class => 'Koha::IssuingRules',
179
            value  => {
180
                branchcode                    => '*',
181
                categorycode                  => '*',
182
                itemtype                      => '*',
183
                fine                          => '1.00',
184
                lengthunit                    => 'days',
185
                finedays                      => 0,
186
                firstremind                   => 0,
187
                chargeperiod                  => 1,
188
                overduefinescap               => 3,
189
                cap_fine_to_replacement_price => 1,
190
            },
191
        }
192
    );
193
194
    my $start_dt = DateTime->new(
195
        year       => 2000,
196
        month      => 1,
197
        day        => 1,
198
    );
199
200
    my $end_dt = DateTime->new(
201
        year       => 2000,
202
        month      => 1,
203
        day        => 30,
204
    );
205
206
    my ($amount) = CalcFine( $item, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
207
    is( int($amount), 3, 'Got the lesser of overduefinescap and replacement price where overduefinescap < replacement price' );
208
209
    $issuingrule->overduefinescap(6)->store();
210
    ($amount) = CalcFine( $item, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
211
    is( int($amount), 5, 'Get the lesser of overduefinescap and replacement price where overduefinescap > replacement price' );
212
213
    teardown();
214
};
215
172
sub teardown {
216
sub teardown {
173
    $dbh->do(q|DELETE FROM issuingrules|);
217
    $dbh->do(q|DELETE FROM issuingrules|);
174
}
218
}
175
- 

Return to bug 18344