From b7b883dea3d026fbc75f951cfe327acea8434184 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Fri, 17 Jan 2020 10:48:50 +0100 Subject: [PATCH] Bug 24443: Unit test --- t/db_dependent/Items.t | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t index 8ac9e7ef22..538b34088a 100755 --- a/t/db_dependent/Items.t +++ b/t/db_dependent/Items.t @@ -368,7 +368,7 @@ subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub { }; subtest 'SearchItems test' => sub { - plan tests => 14; + plan tests => 15; $schema->storage->txn_begin; my $dbh = C4::Context->dbh; @@ -402,6 +402,7 @@ subtest 'SearchItems test' => sub { homebranch => $library2->{branchcode}, holdingbranch => $library2->{branchcode}, itype => $itemtype->{itemtype}, + issues => 3, }, $biblio->biblionumber); my ($items, $total_results); @@ -543,6 +544,15 @@ subtest 'SearchItems test' => sub { my $cpl_items_after = SearchItemsByField( 'homebranch', $library1->{branchcode}); is( ( scalar( @$cpl_items_after ) - scalar ( @$cpl_items_before ) ), 1, 'SearchItemsByField should return something' ); + # Issues count may be NULL + $filter = { + field => 'issues', + query => 0, + operator => '=', + }; + ($items, $total_results) = SearchItems($filter); + is($total_results, 1, "Search items.issues is NULL with filter issues = 0"); + $schema->storage->txn_rollback; }; -- 2.24.1