Bug 24443: Unit test
Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
This commit is contained in:
parent
2922249d92
commit
ef3c039e5d
|
|
@ -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,25 @@ 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 = {
|
||||
conjunction => 'AND',
|
||||
filters => [
|
||||
{
|
||||
field => 'issues',
|
||||
query => 0,
|
||||
operator => '=',
|
||||
},
|
||||
{
|
||||
field => 'homebranch',
|
||||
query => $library1->{branchcode},
|
||||
operator => '=',
|
||||
},
|
||||
],
|
||||
};
|
||||
($items, $total_results) = SearchItems($filter);
|
||||
is($total_results, 1, "Search items.issues is NULL with filter issues = 0");
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue