From 4bb6198f73cb22eb5e733fb41b77135a176be431 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 13 Nov 2020 09:23:51 +0100 Subject: [PATCH] Bug 26963: Ignore existing libraries --- t/db_dependent/Koha/Item.t | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index 97fe8400c7..10c5f1dff3 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -156,6 +156,7 @@ subtest "as_marc_field() tests" => sub { }; subtest 'pickup_locations' => sub { + plan tests => 66; $schema->storage->txn_begin; @@ -173,6 +174,10 @@ subtest 'pickup_locations' => sub { my $group2_1 = $builder->build_object( { class => 'Koha::Library::Groups', value => { parent_id => $root2->id, branchcode => $library3->branchcode } } ); my $group2_2 = $builder->build_object( { class => 'Koha::Library::Groups', value => { parent_id => $root2->id, branchcode => $library4->branchcode } } ); + our @branchcodes = ( + $library1->branchcode, $library2->branchcode, + $library3->branchcode, $library4->branchcode + ); my $item1 = $builder->build_sample_item( { @@ -208,7 +213,6 @@ subtest 'pickup_locations' => sub { my $patron4 = $builder->build_object( { class => 'Koha::Patrons', value => { branchcode => $library4->branchcode, firstname => '4' } } ); my $all_count = Koha::Libraries->search({ pickup_location => 1})->count(); - plan tests => ($all_count +1) * 7 + 31 + 61; my $results = { "1-1-1-any" => $all_count, @@ -291,6 +295,8 @@ subtest 'pickup_locations' => sub { my $ha_value=$ha==3?'holdgroup':($ha==2?'any':'homebranch'); foreach my $pickup_location (@pl) { + next + unless grep { $pickup_location eq $_ } @branchcodes; is( ref($pickup_location), 'Koha::Library', 'Object type is correct' ); } ok( -- 2.20.1