|
Lines 33-44
$schema->storage->txn_begin;
Link Here
|
| 33 |
my $builder = t::lib::TestBuilder->new; |
33 |
my $builder = t::lib::TestBuilder->new; |
| 34 |
|
34 |
|
| 35 |
subtest 'set_rule + get_effective_rule' => sub { |
35 |
subtest 'set_rule + get_effective_rule' => sub { |
| 36 |
plan tests => 13; |
36 |
plan tests => 14; |
| 37 |
|
37 |
|
| 38 |
my $categorycode = $builder->build_object( { class => 'Koha::Patron::Categories' } )->categorycode; |
38 |
my $categorycode = $builder->build_object( { class => 'Koha::Patron::Categories' } )->categorycode; |
| 39 |
my $itemtype = $builder->build_object( { class => 'Koha::ItemTypes' } )->itemtype; |
39 |
my $itemtype = $builder->build_object( { class => 'Koha::ItemTypes' } )->itemtype; |
| 40 |
my $branchcode = $builder->build_object( { class => 'Koha::Libraries' } )->branchcode; |
40 |
my $branchcode = $builder->build_object( { class => 'Koha::Libraries' } )->branchcode; |
| 41 |
my $rule_name = 'my_rule'; |
41 |
my $branchcode_2 = $builder->build_object( { class => 'Koha::Libraries' } )->branchcode; |
|
|
42 |
my $rule_name = 'maxissueqty'; |
| 42 |
my $default_rule_value = 1; |
43 |
my $default_rule_value = 1; |
| 43 |
|
44 |
|
| 44 |
my $rule; |
45 |
my $rule; |
|
Lines 109-114
subtest 'set_rule + get_effective_rule' => sub {
Link Here
|
| 109 |
is( $rule->rule_value, 2, |
110 |
is( $rule->rule_value, 2, |
| 110 |
'More specific rule is returned when itemtype is given' ); |
111 |
'More specific rule is returned when itemtype is given' ); |
| 111 |
|
112 |
|
|
|
113 |
$rule = Koha::CirculationRules->get_effective_rule( |
| 114 |
{ |
| 115 |
branchcode => $branchcode_2, |
| 116 |
categorycode => '*', |
| 117 |
itemtype => '*', |
| 118 |
rule_name => $rule_name, |
| 119 |
} |
| 120 |
); |
| 121 |
is( $rule->rule_value, 1, |
| 122 |
'Default rule is returned if there is no rule for this branchcode' ); |
| 123 |
|
| 112 |
Koha::CirculationRules->set_rule( |
124 |
Koha::CirculationRules->set_rule( |
| 113 |
{ |
125 |
{ |
| 114 |
branchcode => '*', |
126 |
branchcode => '*', |
| 115 |
- |
|
|