Bugzilla – Attachment 130848 Details for
Bug 17748
Show due date in item search results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17748: Add tests
Bug-17748-Add-tests.patch (text/plain), 3.14 KB, created by
Jonathan Druart
on 2022-02-18 14:15:17 UTC
(
hide
)
Description:
Bug 17748: Add tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-02-18 14:15:17 UTC
Size:
3.14 KB
patch
obsolete
>From 48d2a3e7472cfa64ce3f32c944ecbbda22720854 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Wed, 2 Feb 2022 01:33:59 +1300 >Subject: [PATCH] Bug 17748: Add tests > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/Items.t | 29 ++++++++++++++++++++++++++--- > 1 file changed, 26 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index 120d9b9307d..5aa9260a485 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -21,6 +21,7 @@ use Data::Dumper; > use MARC::Record; > use C4::Items qw( ModItemTransfer GetHiddenItemnumbers GetItemsInfo SearchItems AddItemFromMarc ModItemFromMarc get_hostitemnumbers_of Item2Marc ); > use C4::Biblio qw( GetMarcFromKohaField EmbedItemsInMarcBiblio GetMarcBiblio AddBiblio ); >+use C4::Circulation qw( AddIssue ); > use Koha::Items; > use Koha::Database; > use Koha::DateUtils qw( dt_from_string ); >@@ -407,7 +408,7 @@ subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub { > }; > > subtest 'SearchItems test' => sub { >- plan tests => 17; >+ plan tests => 19; > > $schema->storage->txn_begin; > my $dbh = C4::Context->dbh; >@@ -432,13 +433,14 @@ subtest 'SearchItems test' => sub { > my (undef, $initial_items_count) = SearchItems(undef, {rows => 1}); > > # Add two items >- my $item1_itemnumber = $builder->build_sample_item( >+ my $item1 = $builder->build_sample_item( > { > biblionumber => $biblio->biblionumber, > library => $library1->{branchcode}, > itype => $itemtype->{itemtype} > } >- )->itemnumber; >+ ); >+ my $item1_itemnumber = $item1->itemnumber; > my $item2_itemnumber = $builder->build_sample_item( > { > biblionumber => $biblio->biblionumber, >@@ -450,6 +452,7 @@ subtest 'SearchItems test' => sub { > my ($items, $total_results); > > ($items, $total_results) = SearchItems(); >+ > is($total_results, $initial_items_count + 2, "Created 2 new items"); > is(scalar @$items, $total_results, "SearchItems() returns all items"); > >@@ -628,6 +631,26 @@ subtest 'SearchItems test' => sub { > ($items, $total_results) = SearchItems($filter); > is($total_results, 1, 'found all items of library1 with new_status=0 with ifnull = 0'); > >+ t::lib::Mocks::mock_userenv({ branchcode => $item1->homebranch }); >+ my $patron_borrower = $builder->build_object({ class => 'Koha::Patrons' })->unblessed; >+ AddIssue( $patron_borrower, $item1->barcode ); >+ # Search item where item is checked out >+ $filter = { >+ field => 'onloan', >+ query => 'not null', >+ operator => 'is', >+ }; >+ ($items, $total_results) = SearchItems($filter); >+ ok(scalar @$items == 1, 'found 1 checked out item'); >+ >+ # When sorting by descending availability, checked out item should show first >+ my $params = { >+ sortby => 'availability', >+ sortorder => 'DESC', >+ }; >+ ($items, $total_results) = SearchItems(undef,$params); >+ is($items->[0]->{barcode}, $item1->barcode, 'Items sorted as expected by availability'); >+ > $schema->storage->txn_rollback; > }; > >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17748
:
116353
|
119341
|
128332
|
128333
|
128582
|
128583
|
128584
|
128591
|
128638
|
128645
|
128646
|
128647
|
129623
|
129624
|
129625
|
130154
|
130845
|
130846
|
130847
| 130848 |
130849
|
131051
|
132016
|
132201