Bugzilla – Attachment 86468 Details for
Bug 22219
C4::Biblio->GetItemsForInventory can return wrong count / duplicated items when skipping waiting holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22219: Add tests
Bug-22219-Add-tests.patch (text/plain), 3.00 KB, created by
Josef Moravec
on 2019-03-11 16:45:22 UTC
(
hide
)
Description:
Bug 22219: Add tests
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2019-03-11 16:45:22 UTC
Size:
3.00 KB
patch
obsolete
>From 65a82f828f4f93e4ecf792e79766b754b9a0e38f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 4 Mar 2019 16:52:30 -0300 >Subject: [PATCH] Bug 22219: Add tests > >Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > t/db_dependent/Items/GetItemsForInventory.t | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/Items/GetItemsForInventory.t b/t/db_dependent/Items/GetItemsForInventory.t >index ae5cd7e7ae..d2bb43f77c 100755 >--- a/t/db_dependent/Items/GetItemsForInventory.t >+++ b/t/db_dependent/Items/GetItemsForInventory.t >@@ -62,15 +62,18 @@ subtest 'Old version is unchanged' => sub { > > subtest 'Skip items with waiting holds' => sub { > >- plan tests => 6; >+ plan tests => 7; > > $schema->storage->txn_begin; > > my $library = $builder->build_object( { class => 'Koha::Libraries' } ); > my $itemtype > = $builder->build_object( { class => 'Koha::ItemTypes', value => { rentalcharge => 0 } } ); >- my $patron = $builder->build_object( >+ my $patron_1 = $builder->build_object( > { class => 'Koha::Patrons', value => { branchcode => $library->id } } ); >+ my $patron_2 = $builder->build_object( >+ { class => 'Koha::Patrons', value => { branchcode => $library->id } } ); >+ > > my $title_1 = 'Title 1, '; > my $title_2 = 'Title 2, bizzarre one so doesn\'t already exist'; >@@ -112,11 +115,16 @@ subtest 'Skip items with waiting holds' => sub { > is( scalar @{$items_2}, $second_items_count, 'Results and count match' ); > is( $first_items_count + 2, $second_items_count, 'Two items added, count makes sense' ); > >- # Add a waiting hold >- my $reserve_id >- = C4::Reserves::AddReserve( $library->branchcode, $patron->borrowernumber, >+ # Add 2 waiting holds >+ C4::Reserves::AddReserve( $library->branchcode, $patron_1->borrowernumber, > $item_1->biblionumber, '', 1, undef, undef, '', "title for fee", > $item_1->itemnumber, 'W' ); >+ C4::Reserves::AddReserve( $library->branchcode, $patron_1->borrowernumber, >+ $item_2->biblionumber, '', 1, undef, undef, '', "title for fee", >+ $item_2->itemnumber, undef ); >+ C4::Reserves::AddReserve( $library->branchcode, $patron_2->borrowernumber, >+ $item_2->biblionumber, '', 2, undef, undef, '', "title for fee", >+ $item_2->itemnumber, undef ); > > my ( $new_items, $new_items_count ) = GetItemsForInventory( { ignore_waiting_holds => 1 } ); > is( $new_items_count, $first_items_count + 1, 'Item on hold skipped, count makes sense' ); >@@ -124,6 +132,7 @@ subtest 'Skip items with waiting holds' => sub { > 'Item on hold skipped, the other one we added is present' ); > ok( (none { $_->{title} eq $title_1 } @{$new_items}), > 'Item on hold skipped, no one matches' ); >+ is( scalar(@$new_items), $new_items_count, 'total and number of items is the same'); > > $schema->storage->txn_rollback; > }; >-- >2.11.0
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 22219
:
86030
|
86031
|
86402
|
86403
| 86468 |
86469