Lines 2-8
Link Here
|
2 |
|
2 |
|
3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
4 |
|
4 |
|
5 |
use Test::More tests => 5; |
5 |
use Test::More tests => 7; |
6 |
use Test::Warn; |
6 |
use Test::Warn; |
7 |
|
7 |
|
8 |
use C4::Context; |
8 |
use C4::Context; |
Lines 101-106
subtest 'Test basic functionality' => sub {
Link Here
|
101 |
teardown(); |
101 |
teardown(); |
102 |
}; |
102 |
}; |
103 |
|
103 |
|
|
|
104 |
subtest 'Overdue fines cap should be disabled when value is 0' => sub { |
105 |
plan tests => 1; |
106 |
|
107 |
Koha::CirculationRules->set_rules( |
108 |
{ |
109 |
branchcode => undef, |
110 |
categorycode => undef, |
111 |
itemtype => undef, |
112 |
rules => { |
113 |
fine => '1.00', |
114 |
lengthunit => 'days', |
115 |
finedays => 0, |
116 |
firstremind => 0, |
117 |
chargeperiod => 1, |
118 |
overduefinescap => "0", |
119 |
cap_fine_to_replacement_price => 0, |
120 |
} |
121 |
}, |
122 |
); |
123 |
|
124 |
my $start_dt = DateTime->new( |
125 |
year => 2000, |
126 |
month => 1, |
127 |
day => 1, |
128 |
); |
129 |
|
130 |
my $end_dt = DateTime->new( |
131 |
year => 2000, |
132 |
month => 1, |
133 |
day => 30, |
134 |
); |
135 |
|
136 |
my ($amount) = CalcFine( $item->unblessed, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt ); |
137 |
|
138 |
is( $amount, 29, 'Amount is calculated correctly' ); |
139 |
|
140 |
teardown(); |
141 |
}; |
142 |
|
143 |
subtest 'Overdue fines cap should be disabled when value is 0.00' => sub { |
144 |
plan tests => 1; |
145 |
|
146 |
Koha::CirculationRules->set_rules( |
147 |
{ |
148 |
branchcode => undef, |
149 |
categorycode => undef, |
150 |
itemtype => undef, |
151 |
rules => { |
152 |
fine => '1.00', |
153 |
lengthunit => 'days', |
154 |
finedays => 0, |
155 |
firstremind => 0, |
156 |
chargeperiod => 1, |
157 |
overduefinescap => "0.00", |
158 |
cap_fine_to_replacement_price => 0, |
159 |
} |
160 |
}, |
161 |
); |
162 |
|
163 |
my $start_dt = DateTime->new( |
164 |
year => 2000, |
165 |
month => 1, |
166 |
day => 1, |
167 |
); |
168 |
|
169 |
my $end_dt = DateTime->new( |
170 |
year => 2000, |
171 |
month => 1, |
172 |
day => 30, |
173 |
); |
174 |
|
175 |
my ($amount) = CalcFine( $item->unblessed, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt ); |
176 |
|
177 |
is( $amount, 29, 'Amount is calculated correctly' ); |
178 |
|
179 |
teardown(); |
180 |
}; |
181 |
|
104 |
subtest 'Test with fine amount empty' => sub { |
182 |
subtest 'Test with fine amount empty' => sub { |
105 |
plan tests => 1; |
183 |
plan tests => 1; |
106 |
|
184 |
|
107 |
- |
|
|