Bug 17748: (follow-up) Stronger unit tests
Before this patch, unit tests perform an item search assuming there is no checked-out items in database. This is correct for a fresh reseted database. But if you checkout any item then prove t/db_dependent/Items.t it will fail. We can see in this file that other tests use filter on generated branchcode. This patch adds filter to items.homebranch Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
216bb783e0
commit
29e1681ff1
1 changed files with 19 additions and 4 deletions
|
@ -636,9 +636,19 @@ subtest 'SearchItems test' => sub {
|
|||
AddIssue( $patron_borrower, $item1->barcode );
|
||||
# Search item where item is checked out
|
||||
$filter = {
|
||||
field => 'onloan',
|
||||
query => 'not null',
|
||||
operator => 'is',
|
||||
conjunction => 'AND',
|
||||
filters => [
|
||||
{
|
||||
field => 'onloan',
|
||||
query => 'not null',
|
||||
operator => 'is',
|
||||
},
|
||||
{
|
||||
field => 'homebranch',
|
||||
query => $item1->homebranch,
|
||||
operator => '=',
|
||||
},
|
||||
],
|
||||
};
|
||||
($items, $total_results) = SearchItems($filter);
|
||||
ok(scalar @$items == 1, 'found 1 checked out item');
|
||||
|
@ -648,7 +658,12 @@ subtest 'SearchItems test' => sub {
|
|||
sortby => 'availability',
|
||||
sortorder => 'DESC',
|
||||
};
|
||||
($items, $total_results) = SearchItems(undef,$params);
|
||||
$filter = {
|
||||
field => 'homebranch',
|
||||
query => $item1->homebranch,
|
||||
operator => '=',
|
||||
};
|
||||
($items, $total_results) = SearchItems($filter,$params);
|
||||
is($items->[0]->{barcode}, $item1->barcode, 'Items sorted as expected by availability');
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
|
|
Loading…
Reference in a new issue