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 $checkout_type = $Koha::Checkouts::type->{checkout}; |
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 |
checkout_type => $checkout_type, |
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 |
checkout_type => $checkout_type, |
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/checkout_type succeeds' ); |
|
|
201 |
|
202 |
lives_ok( sub { |
203 |
Koha::CirculationRules->set_rule( { |
204 |
branchcode => $branchcode, |
205 |
categorycode => $categorycode, |
206 |
itemtype => $itemtype, |
207 |
checkout_type => $checkout_type, |
208 |
rule_name => 'maxissueqty', |
209 |
rule_value => 5, |
210 |
} ); |
211 |
}, 'setting maxissueqty with branch/category/itemtype/checkout_type 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 |
checkout_type => $checkout_type, |
215 |
rule_name => 'patron_maxissueqty', |
230 |
rule_name => 'patron_maxissueqty', |
216 |
rule_value => '', |
231 |
rule_value => '', |
217 |
} ); |
232 |
} ); |
218 |
- |
|
|