Browse Source

Bug 18936: (follow-up) Make sure we default to '*' if no rule exist

Making sure the code is doing what we expect.
Also this patch fix CirculationRules.t

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
20.05.x
Jonathan Druart 4 years ago
committed by Martin Renvoize
parent
commit
4072c2e313
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 16
      t/db_dependent/Koha/CirculationRules.t

16
t/db_dependent/Koha/CirculationRules.t

@ -33,12 +33,13 @@ $schema->storage->txn_begin;
my $builder = t::lib::TestBuilder->new;
subtest 'set_rule + get_effective_rule' => sub {
plan tests => 13;
plan tests => 14;
my $categorycode = $builder->build_object( { class => 'Koha::Patron::Categories' } )->categorycode;
my $itemtype = $builder->build_object( { class => 'Koha::ItemTypes' } )->itemtype;
my $branchcode = $builder->build_object( { class => 'Koha::Libraries' } )->branchcode;
my $rule_name = 'my_rule';
my $branchcode_2 = $builder->build_object( { class => 'Koha::Libraries' } )->branchcode;
my $rule_name = 'maxissueqty';
my $default_rule_value = 1;
my $rule;
@ -109,6 +110,17 @@ subtest 'set_rule + get_effective_rule' => sub {
is( $rule->rule_value, 2,
'More specific rule is returned when itemtype is given' );
$rule = Koha::CirculationRules->get_effective_rule(
{
branchcode => $branchcode_2,
categorycode => '*',
itemtype => '*',
rule_name => $rule_name,
}
);
is( $rule->rule_value, 1,
'Default rule is returned if there is no rule for this branchcode' );
Koha::CirculationRules->set_rule(
{
branchcode => '*',

Loading…
Cancel
Save