|
Lines 283-289
subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub {
Link Here
|
| 283 |
}; |
283 |
}; |
| 284 |
|
284 |
|
| 285 |
subtest 'SearchItems test' => sub { |
285 |
subtest 'SearchItems test' => sub { |
| 286 |
plan tests => 20; |
286 |
plan tests => 21; |
| 287 |
|
287 |
|
| 288 |
$schema->storage->txn_begin; |
288 |
$schema->storage->txn_begin; |
| 289 |
my $dbh = C4::Context->dbh; |
289 |
my $dbh = C4::Context->dbh; |
|
Lines 539-544
subtest 'SearchItems test' => sub {
Link Here
|
| 539 |
($items, $total_results) = SearchItems($filter,$params); |
539 |
($items, $total_results) = SearchItems($filter,$params); |
| 540 |
is($items->[0]->{barcode}, $item1->barcode, 'Items sorted as expected by availability'); |
540 |
is($items->[0]->{barcode}, $item1->barcode, 'Items sorted as expected by availability'); |
| 541 |
|
541 |
|
|
|
542 |
subtest 'Sort items by callnumber' => sub { |
| 543 |
plan tests => 2; |
| 544 |
|
| 545 |
# Add two items |
| 546 |
my $item1 = $builder->build_sample_item( |
| 547 |
{ |
| 548 |
itemcallnumber => 'D102.D3 1930', |
| 549 |
cn_source => 'lcc' |
| 550 |
} |
| 551 |
); |
| 552 |
my $item2 = $builder->build_sample_item( |
| 553 |
{ |
| 554 |
library => $item1->homebranch, |
| 555 |
itemcallnumber => 'D1015.B4 1965', |
| 556 |
cn_source => 'lcc' |
| 557 |
} |
| 558 |
); |
| 559 |
my $filter = { |
| 560 |
field => 'homebranch', |
| 561 |
query => $item1->homebranch, |
| 562 |
operator => '=', |
| 563 |
}; |
| 564 |
my $params = { |
| 565 |
sortby => 'itemcallnumber', |
| 566 |
sortorder => 'DESC', |
| 567 |
}; |
| 568 |
( $items, $total_results ) = SearchItems( $filter, $params ); |
| 569 |
is( $items->[0]->{barcode}, $item2->barcode, 'Items sorted by cn_sort correctly' ); |
| 570 |
is( $items->[1]->{barcode}, $item1->barcode, 'Items sorted by cn_sort correctly' ); |
| 571 |
}; |
| 572 |
|
| 542 |
subtest 'Search items by ISSN and ISBN with variations' => sub { |
573 |
subtest 'Search items by ISSN and ISBN with variations' => sub { |
| 543 |
plan tests => 4; |
574 |
plan tests => 4; |
| 544 |
|
575 |
|
| 545 |
- |
|
|