Lines 19-29
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 3; |
22 |
use Test::More tests => 4; |
23 |
|
23 |
|
24 |
use Benchmark; |
24 |
use Benchmark; |
25 |
|
25 |
|
26 |
use Koha::IssuingRules; |
26 |
use Koha::IssuingRules; |
|
|
27 |
use Koha::CirculationRules; |
27 |
|
28 |
|
28 |
use t::lib::TestBuilder; |
29 |
use t::lib::TestBuilder; |
29 |
use t::lib::Mocks; |
30 |
use t::lib::Mocks; |
Lines 306-311
subtest 'get_onshelfholds_policy' => sub {
Link Here
|
306 |
is( Koha::IssuingRules->get_onshelfholds_policy({ item => $item, patron => $patron }), 2, 'Should be two now' ); |
307 |
is( Koha::IssuingRules->get_onshelfholds_policy({ item => $item, patron => $patron }), 2, 'Should be two now' ); |
307 |
}; |
308 |
}; |
308 |
|
309 |
|
|
|
310 |
subtest 'delete' => sub { |
311 |
plan tests => 1; |
312 |
|
313 |
my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes' }); |
314 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
315 |
my $category = $builder->build_object({ class => 'Koha::Patron::Categories' }); |
316 |
|
317 |
# We make an issuing rule |
318 |
my $issue_rule = $builder->build_object({ class => 'Koha::IssuingRules', value => { |
319 |
categorycode => $category->categorycode, |
320 |
itemtype => $itemtype->itemtype, |
321 |
branchcode => $library->branchcode |
322 |
} |
323 |
}); |
324 |
|
325 |
my $count = Koha::CirculationRules->search()->count; |
326 |
# Note how many circulation rules we start with |
327 |
|
328 |
# We make some circulation rules for the same thing |
329 |
$builder->build_object({ class => 'Koha::CirculationRules', value => { |
330 |
categorycode => $category->categorycode, |
331 |
itemtype => $itemtype->itemtype, |
332 |
branchcode => $library->branchcode |
333 |
} |
334 |
}); |
335 |
$builder->build_object({ class => 'Koha::CirculationRules', value => { |
336 |
categorycode => $category->categorycode, |
337 |
itemtype => $itemtype->itemtype, |
338 |
branchcode => $library->branchcode |
339 |
} |
340 |
}); |
341 |
|
342 |
# Now we delete the issuing rule |
343 |
$issue_rule->delete; |
344 |
is( Koha::CirculationRules->search()->count ,$count, "We remove related circ rules with our issuing rule"); |
345 |
|
346 |
}; |
347 |
|
309 |
sub _row_match { |
348 |
sub _row_match { |
310 |
my ($rule, $branchcode, $categorycode, $itemtype) = @_; |
349 |
my ($rule, $branchcode, $categorycode, $itemtype) = @_; |
311 |
|
350 |
|
312 |
- |
|
|