Bug 29087: (QA follow-up): Fix QA tests
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> [EDIT] Conform BZ comment31 Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
44d3762a69
commit
7f5e1fac86
3 changed files with 11 additions and 9 deletions
|
@ -68,7 +68,7 @@ sub filter_by_for_hold {
|
|||
}
|
||||
);
|
||||
my @hold_not_allowed_itypes;
|
||||
if ( $default_rule ) {
|
||||
if ($default_rule) {
|
||||
@hold_not_allowed_itypes = Koha::ItemTypes->search->get_column('itemtype');
|
||||
my @hold_allowed_itypes = Koha::CirculationRules->search(
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ sub filter_by_for_hold {
|
|||
categorycode => undef,
|
||||
}
|
||||
)->get_column('itemtype');
|
||||
@hold_not_allowed_itypes = array_minus( @hold_not_allowed_itypes, @hold_allowed_itypes )
|
||||
@hold_not_allowed_itypes = array_minus( @hold_not_allowed_itypes, @hold_allowed_itypes );
|
||||
} else {
|
||||
@hold_not_allowed_itypes = Koha::CirculationRules->search(
|
||||
{
|
||||
|
|
|
@ -535,8 +535,8 @@ subtest 'get_items_that_can_fill' => sub {
|
|||
|
||||
Koha::CirculationRules->search(
|
||||
{
|
||||
rule_name => 'holdallowed',
|
||||
rule_value => 'not_allowed',
|
||||
rule_name => 'holdallowed',
|
||||
rule_value => 'not_allowed',
|
||||
}
|
||||
)->delete;
|
||||
|
||||
|
|
|
@ -2011,10 +2011,10 @@ subtest 'filter_by_for_hold' => sub {
|
|||
rule_value => 'not_allowed',
|
||||
}
|
||||
);
|
||||
my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes' });
|
||||
my $itemtype = $builder->build_object( { class => 'Koha::ItemTypes' } );
|
||||
my $not_holdable_itemtype = $itemtype->itemtype;
|
||||
my $itemtype2 = $builder->build_object({ class => 'Koha::ItemTypes' });
|
||||
my $holdable_itemtype = $itemtype2->itemtype;
|
||||
my $itemtype2 = $builder->build_object( { class => 'Koha::ItemTypes' } );
|
||||
my $holdable_itemtype = $itemtype2->itemtype;
|
||||
Koha::CirculationRules->set_rule(
|
||||
{
|
||||
branchcode => undef,
|
||||
|
@ -2028,9 +2028,11 @@ subtest 'filter_by_for_hold' => sub {
|
|||
my $library = $builder->build_object({ class => 'Koha::Libraries' });
|
||||
t::lib::Mocks::mock_preference('IndependentBranches', 0); # more robust tests
|
||||
is( $biblio->items->filter_by_for_hold->count, 0, 'no item yet' );
|
||||
$builder->build_sample_item( { biblionumber => $biblio->biblionumber, notforloan => 0, itype => $not_holdable_itemtype } );
|
||||
$builder->build_sample_item(
|
||||
{ biblionumber => $biblio->biblionumber, notforloan => 0, itype => $not_holdable_itemtype } );
|
||||
is( $biblio->items->filter_by_for_hold->count, 0, 'default rule prevents hold' );
|
||||
$builder->build_sample_item( { biblionumber => $biblio->biblionumber, notforloan => 0, itype => $holdable_itemtype } );
|
||||
$builder->build_sample_item(
|
||||
{ biblionumber => $biblio->biblionumber, notforloan => 0, itype => $holdable_itemtype } );
|
||||
is( $biblio->items->filter_by_for_hold->count, 1, 'hold allowed despite default rule' );
|
||||
|
||||
# Reset items and circ rules to remove default rule
|
||||
|
|
Loading…
Reference in a new issue