diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t index 42c31b5ab0..7e4a4f69cd 100644 --- a/t/db_dependent/Koha/Items.t +++ b/t/db_dependent/Koha/Items.t @@ -201,7 +201,8 @@ subtest 'filter_by_visible_in_opac() tests' => sub { biblionumber => $biblio->biblionumber, itemlost => -1, itype => $itype_1->itemtype, - withdrawn => 1 + withdrawn => 1, + copynumber => undef } ); my $item_2 = $builder->build_sample_item( @@ -209,7 +210,8 @@ subtest 'filter_by_visible_in_opac() tests' => sub { biblionumber => $biblio->biblionumber, itemlost => 0, itype => $itype_2->itemtype, - withdrawn => 2 + withdrawn => 2, + copynumber => undef } ); my $item_3 = $builder->build_sample_item( @@ -217,7 +219,8 @@ subtest 'filter_by_visible_in_opac() tests' => sub { biblionumber => $biblio->biblionumber, itemlost => 1, itype => $itype_1->itemtype, - withdrawn => 3 + withdrawn => 3, + copynumber => undef } ); my $item_4 = $builder->build_sample_item( @@ -225,7 +228,8 @@ subtest 'filter_by_visible_in_opac() tests' => sub { biblionumber => $biblio->biblionumber, itemlost => 0, itype => $itype_2->itemtype, - withdrawn => 4 + withdrawn => 4, + copynumber => undef } ); my $item_5 = $builder->build_sample_item( @@ -233,7 +237,8 @@ subtest 'filter_by_visible_in_opac() tests' => sub { biblionumber => $biblio->biblionumber, itemlost => 0, itype => $itype_1->itemtype, - withdrawn => 5 + withdrawn => 5, + copynumber => undef } ); my $item_6 = $builder->build_sample_item( @@ -241,7 +246,8 @@ subtest 'filter_by_visible_in_opac() tests' => sub { biblionumber => $biblio->biblionumber, itemlost => 2, itype => $itype_1->itemtype, - withdrawn => 5 + withdrawn => 5, + copynumber => undef } ); @@ -259,7 +265,7 @@ subtest 'filter_by_visible_in_opac() tests' => sub { is( $biblio->items->filter_by_visible_in_opac({ patron => $patron })->count, 6, 'No rules passed, hidelostitems unset, patron exception changes nothing' ); - $rules = {}; + $rules = { copynumber => [ 2 ] }; t::lib::Mocks::mock_preference( 'hidelostitems', 1 ); is( @@ -274,7 +280,7 @@ subtest 'filter_by_visible_in_opac() tests' => sub { 'No rules passed, hidelostitems set, patron exception changes nothing' ); - $rules = { withdrawn => [ 1, 2 ] }; + $rules = { withdrawn => [ 1, 2 ], copynumber => [ 2 ] }; is( $biblio->items->filter_by_visible_in_opac->count, 2, @@ -287,14 +293,14 @@ subtest 'filter_by_visible_in_opac() tests' => sub { 'hidelostitems set, rules on withdrawn but patron override passed' ); - $rules = { itype => [ $itype_1->itemtype ] }; + $rules = { itype => [ $itype_1->itemtype ], copynumber => [ 2 ] }; is( $biblio->items->filter_by_visible_in_opac->count, 2, 'Rules on itype, hidelostitems set' ); - $rules = { withdrawn => [ 1, 2 ], itype => [ $itype_1->itemtype ] }; + $rules = { withdrawn => [ 1, 2 ], itype => [ $itype_1->itemtype ], copynumber => [ 2 ] }; is( $biblio->items->filter_by_visible_in_opac->count, 1, @@ -307,7 +313,7 @@ subtest 'filter_by_visible_in_opac() tests' => sub { 'The right item is returned' ); - $rules = { withdrawn => [ 1, 2 ], itype => [ $itype_2->itemtype ] }; + $rules = { withdrawn => [ 1, 2 ], itype => [ $itype_2->itemtype ], copynumber => [ 2 ] }; is( $biblio->items->filter_by_visible_in_opac->count, 1,