|
Lines 33-39
$schema->storage->txn_begin;
Link Here
|
| 33 |
my $builder = t::lib::TestBuilder->new; |
33 |
my $builder = t::lib::TestBuilder->new; |
| 34 |
|
34 |
|
| 35 |
subtest 'get_effective_issuing_rule' => sub { |
35 |
subtest 'get_effective_issuing_rule' => sub { |
| 36 |
plan tests => 2; |
36 |
plan tests => 3; |
| 37 |
|
37 |
|
| 38 |
my $patron = $builder->build({ source => 'Borrower' }); |
38 |
my $patron = $builder->build({ source => 'Borrower' }); |
| 39 |
my $item = $builder->build({ source => 'Item' }); |
39 |
my $item = $builder->build({ source => 'Item' }); |
|
Lines 42-47
subtest 'get_effective_issuing_rule' => sub {
Link Here
|
| 42 |
my $itemtype = $item->{'itype'}; |
42 |
my $itemtype = $item->{'itype'}; |
| 43 |
my $branchcode = $item->{'homebranch'}; |
43 |
my $branchcode = $item->{'homebranch'}; |
| 44 |
|
44 |
|
|
|
45 |
subtest 'Call with undefined values' => sub { |
| 46 |
plan tests => 4; |
| 47 |
|
| 48 |
my $rule; |
| 49 |
Koha::IssuingRules->delete; |
| 50 |
ok(!Koha::IssuingRules->search->count, 'There are no issuing rules.'); |
| 51 |
$rule = Koha::IssuingRules->get_effective_issuing_rule({ |
| 52 |
branchcode => undef, |
| 53 |
categorycode => undef, |
| 54 |
itemtype => undef, |
| 55 |
}); |
| 56 |
is($rule, undef, 'When I attempt to get effective issuing rule by' |
| 57 |
.' providing undefined values, then undef is returned.'); |
| 58 |
ok(Koha::IssuingRule->new({ |
| 59 |
branchcode => '*', |
| 60 |
categorycode => '*', |
| 61 |
itemtype => '*', |
| 62 |
})->store, 'Given I added an issuing rule branchcode => *,' |
| 63 |
.' categorycode => *, itemtype => *,'); |
| 64 |
$rule = Koha::IssuingRules->get_effective_issuing_rule({ |
| 65 |
branchcode => undef, |
| 66 |
categorycode => undef, |
| 67 |
itemtype => undef, |
| 68 |
}); |
| 69 |
ok(_row_match($rule, '*', '*', '*'), 'When I attempt to get effective' |
| 70 |
.' issuing rule by providing undefined values, then the above one is' |
| 71 |
.' returned.'); |
| 72 |
}; |
| 73 |
|
| 45 |
subtest 'Get effective issuing rule in correct order' => sub { |
74 |
subtest 'Get effective issuing rule in correct order' => sub { |
| 46 |
plan tests => 18; |
75 |
plan tests => 18; |
| 47 |
|
76 |
|
| 48 |
- |
|
|