Lines 154-162
subtest 'set_rule' => sub {
Link Here
|
154 |
my $branchcode = $builder->build({ source => 'Branch' })->{'branchcode'}; |
154 |
my $branchcode = $builder->build({ source => 'Branch' })->{'branchcode'}; |
155 |
my $categorycode = $builder->build({ source => 'Category' })->{'categorycode'}; |
155 |
my $categorycode = $builder->build({ source => 'Category' })->{'categorycode'}; |
156 |
my $itemtype = $builder->build({ source => 'Itemtype' })->{'itemtype'}; |
156 |
my $itemtype = $builder->build({ source => 'Itemtype' })->{'itemtype'}; |
|
|
157 |
my $onsite_checkout = 0; |
157 |
|
158 |
|
158 |
subtest 'Correct call' => sub { |
159 |
subtest 'Correct call' => sub { |
159 |
plan tests => 4; |
160 |
plan tests => 5; |
160 |
|
161 |
|
161 |
Koha::CirculationRules->delete; |
162 |
Koha::CirculationRules->delete; |
162 |
|
163 |
|
Lines 172-177
subtest 'set_rule' => sub {
Link Here
|
172 |
Koha::CirculationRules->set_rule( { |
173 |
Koha::CirculationRules->set_rule( { |
173 |
branchcode => $branchcode, |
174 |
branchcode => $branchcode, |
174 |
categorycode => $categorycode, |
175 |
categorycode => $categorycode, |
|
|
176 |
onsite_checkout => $onsite_checkout, |
175 |
rule_name => 'patron_maxissueqty', |
177 |
rule_name => 'patron_maxissueqty', |
176 |
rule_value => '', |
178 |
rule_value => '', |
177 |
} ); |
179 |
} ); |
Lines 191-200
subtest 'set_rule' => sub {
Link Here
|
191 |
branchcode => $branchcode, |
193 |
branchcode => $branchcode, |
192 |
categorycode => $categorycode, |
194 |
categorycode => $categorycode, |
193 |
itemtype => $itemtype, |
195 |
itemtype => $itemtype, |
|
|
196 |
onsite_checkout => $onsite_checkout, |
194 |
rule_name => 'fine', |
197 |
rule_name => 'fine', |
195 |
rule_value => '', |
198 |
rule_value => '', |
196 |
} ); |
199 |
} ); |
197 |
}, 'setting fine with branch/category/itemtype succeeds' ); |
200 |
}, 'setting fine with branch/category/itemtype/onsite_checkout succeeds' ); |
|
|
201 |
|
202 |
lives_ok( sub { |
203 |
Koha::CirculationRules->set_rule( { |
204 |
branchcode => $branchcode, |
205 |
categorycode => $categorycode, |
206 |
itemtype => $itemtype, |
207 |
onsite_checkout => $onsite_checkout, |
208 |
rule_name => 'maxissueqty', |
209 |
rule_value => 5, |
210 |
} ); |
211 |
}, 'setting maxissueqty with branch/category/itemtype/onsite_checkout succeeds' ); |
198 |
}; |
212 |
}; |
199 |
|
213 |
|
200 |
subtest 'Call with missing params' => sub { |
214 |
subtest 'Call with missing params' => sub { |
Lines 212-217
subtest 'set_rule' => sub {
Link Here
|
212 |
throws_ok( sub { |
226 |
throws_ok( sub { |
213 |
Koha::CirculationRules->set_rule( { |
227 |
Koha::CirculationRules->set_rule( { |
214 |
branchcode => $branchcode, |
228 |
branchcode => $branchcode, |
|
|
229 |
onsite_checkout => $onsite_checkout, |
215 |
rule_name => 'patron_maxissueqty', |
230 |
rule_name => 'patron_maxissueqty', |
216 |
rule_value => '', |
231 |
rule_value => '', |
217 |
} ); |
232 |
} ); |
Lines 229-234
subtest 'set_rule' => sub {
Link Here
|
229 |
Koha::CirculationRules->set_rule( { |
244 |
Koha::CirculationRules->set_rule( { |
230 |
branchcode => $branchcode, |
245 |
branchcode => $branchcode, |
231 |
categorycode => $categorycode, |
246 |
categorycode => $categorycode, |
|
|
247 |
onsite_checkout => undef, |
232 |
rule_name => 'fine', |
248 |
rule_name => 'fine', |
233 |
rule_value => '', |
249 |
rule_value => '', |
234 |
} ); |
250 |
} ); |
Lines 236-242
subtest 'set_rule' => sub {
Link Here
|
236 |
}; |
252 |
}; |
237 |
|
253 |
|
238 |
subtest 'Call with extra params' => sub { |
254 |
subtest 'Call with extra params' => sub { |
239 |
plan tests => 3; |
255 |
plan tests => 4; |
240 |
|
256 |
|
241 |
Koha::CirculationRules->delete; |
257 |
Koha::CirculationRules->delete; |
242 |
|
258 |
|
Lines 252-257
subtest 'set_rule' => sub {
Link Here
|
252 |
throws_ok( sub { |
268 |
throws_ok( sub { |
253 |
Koha::CirculationRules->set_rule( { |
269 |
Koha::CirculationRules->set_rule( { |
254 |
branchcode => $branchcode, |
270 |
branchcode => $branchcode, |
|
|
271 |
onsite_checkout => undef, |
255 |
categorycode => $categorycode, |
272 |
categorycode => $categorycode, |
256 |
itemtype => $itemtype, |
273 |
itemtype => $itemtype, |
257 |
rule_name => 'patron_maxissueqty', |
274 |
rule_name => 'patron_maxissueqty', |
Lines 268-273
subtest 'set_rule' => sub {
Link Here
|
268 |
rule_value => '', |
285 |
rule_value => '', |
269 |
} ); |
286 |
} ); |
270 |
}, qr/categorycode/, 'setting holdallowed with categorycode fails' ); |
287 |
}, qr/categorycode/, 'setting holdallowed with categorycode fails' ); |
|
|
288 |
|
289 |
throws_ok( sub { |
290 |
Koha::CirculationRules->set_rule( { |
291 |
branchcode => $branchcode, |
292 |
onsite_checkout => undef, |
293 |
rule_name => 'holdallowed', |
294 |
itemtype => $itemtype, |
295 |
rule_value => '', |
296 |
} ); |
297 |
}, qr/onsite_checkout/, 'setting holdallowed with onsite_checkout fails' ); |
271 |
}; |
298 |
}; |
272 |
}; |
299 |
}; |
273 |
|
300 |
|
274 |
- |
|
|