Bugzilla – Attachment 24581 Details for
Bug 10827
List of holds does not update correctly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10827: Regression tests
Bug-10827-Regression-tests.patch (text/plain), 6.94 KB, created by
Jonathan Druart
on 2014-01-20 16:25:07 UTC
(
hide
)
Description:
Bug 10827: Regression tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-01-20 16:25:07 UTC
Size:
6.94 KB
patch
obsolete
>From 238791188c503e5374de063af8ad11d46b0d735c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 20 Jan 2014 16:40:50 +0100 >Subject: [PATCH] Bug 10827: Regression tests > >The unit tests in the file db_dependent/Reserves/priorities.t describe >the issue. > >To reproduce using the interface: >- Create 3 patrons A, B and C >- Check an item out to A >- Place a hold on this item for B and C >- Check the item in >- Confirm the hold >- Verify the hold list: > The item is waiting for B and C has a priority 2 >- Delete the hold for B >- Now you can see the item is not waiting for C. He has not been > notified neither. > >If you apply all patches from this bug, at the next ste, the item is >marked as waiting for C and C has been notified when the hold for B has >been deleted. > >/!\Important note: This patch only manages item-level holds! >The commented UT is for biblio-level holds. >--- > t/db_dependent/Reserves/priorities.t | 169 ++++++++++++++++++++++++++++++++++ > 1 file changed, 169 insertions(+) > create mode 100644 t/db_dependent/Reserves/priorities.t > >diff --git a/t/db_dependent/Reserves/priorities.t b/t/db_dependent/Reserves/priorities.t >new file mode 100644 >index 0000000..c02bfee >--- /dev/null >+++ b/t/db_dependent/Reserves/priorities.t >@@ -0,0 +1,169 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+ >+use Data::Dumper; >+use Test::More; >+ >+use MARC::Record; >+ >+use C4::Biblio; >+use C4::Circulation; >+use C4::Context; >+use C4::Items; >+use C4::Members; >+use C4::Reserves; >+ >+my $dbh = C4::Context->dbh; >+ >+# Start transaction >+$dbh->{AutoCommit} = 0; >+$dbh->{RaiseError} = 1; >+ >+C4::Context->_new_userenv('xxx'); >+C4::Context::set_userenv(0,0,0,'firstname','surname', 'CPL', 'CPL', '', '', ''); >+ >+my $record = MARC::Record->new; >+my ( $biblionumber ) = AddBiblio( $record, '' ); >+my ( $barcode1, $barcode2 ) = ( 'UT_prio_barcode_1', 'UT_prio_barcode_2' ); >+my ( undef, undef, $itemnumber1) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL', barcode => $barcode1 }, $biblionumber); >+my ( undef, undef, $itemnumber2) = AddItem({ homebranch => 'MPL', holdingbranch => 'MPL', barcode => $barcode2 }, $biblionumber); >+ >+my $borrowernumber1 = AddMember ( >+ firstname => 'ill borrow', >+ surname => 'foo', >+ categorycode => 'PT', >+ branchcode => 'CPL', >+); >+my $borrower1 = GetMember( borrowernumber => $borrowernumber1 ); >+my $borrowernumber2 = AddMember ( >+ firstname => 'ill place the first hold', >+ surname => 'foo', >+ categorycode => 'PT', >+ branchcode => 'CPL', >+); >+my $borrower2 = GetMember( borrowernumber => $borrowernumber2 ); >+my $borrowernumber3 = AddMember ( >+ firstname => 'ill place the second hold', >+ surname => 'foo', >+ categorycode => 'PT', >+ branchcode => 'CPL', >+); >+my $borrower3 = GetMember( borrowernumber => $borrowernumber3 ); >+ >+ >+my ( $reserve2, $reserve3 ); >+AddIssue( $borrower1, $barcode1 ); >+AddReserve( 'CPL', $borrowernumber2, $biblionumber, 'a', undef, 1, undef, undef, undef, undef, $itemnumber1 ); >+AddReserve( 'CPL', $borrowernumber3, $biblionumber, 'a', undef, 2, undef, undef, undef, undef, $itemnumber1 ); >+ >+( $reserve2 ) = GetReservesFromBorrowernumber( $borrowernumber2 ); >+AddReturn( $barcode1 ); >+ModReserveAffect( $itemnumber1, $borrowernumber2 ); >+ >+( $reserve2 ) = GetReservesFromBorrowernumber( $borrowernumber2 ); >+is( $reserve2->{borrowernumber}, $borrowernumber2 ); >+is( $reserve2->{priority}, 0 ); >+is( $reserve2->{itemnumber}, $itemnumber1 ); >+is( $reserve2->{found}, 'W' ); >+ >+( $reserve3 ) = GetReservesFromBorrowernumber( $borrowernumber3 ); >+is( $reserve3->{borrowernumber}, $borrowernumber3 ); >+is( $reserve3->{priority}, 2 ); >+is( $reserve3->{itemnumber}, $itemnumber1 ); >+is( $reserve3->{found}, undef ); >+ >+CancelReserve({ reserve_id => $reserve2->{reserve_id} }); >+ >+( $reserve2 ) = GetReservesFromBorrowernumber( $borrowernumber2 ); >+is( $reserve2, undef ); >+ >+( $reserve3 ) = GetReservesFromBorrowernumber( $borrowernumber3 ); >+is( $reserve3->{borrowernumber}, $borrowernumber3 ); >+is( $reserve3->{priority}, 0 ); >+is( $reserve3->{itemnumber}, $itemnumber1 ); >+is( $reserve3->{found}, 'W' ); >+ >+CancelReserve({ reserve_id => $reserve3->{reserve_id} }); >+ >+( $reserve3 ) = GetReservesFromBorrowernumber( $borrowernumber3 ); >+is( $reserve3, undef ); >+ >+ >+ >+AddIssue( $borrower1, $barcode1 ); >+AddReserve( 'CPL', $borrowernumber2, $biblionumber, 'a', undef, 1); >+AddReserve( 'CPL', $borrowernumber3, $biblionumber, 'a', undef, 2 ); >+C4::Context->set_preference('ConfirmFutureHolds', 2); >+my ( undef, $message ) = AddReturn( $barcode1 ); >+ModReserveAffect( $itemnumber1, $borrowernumber2 ); >+ >+( $reserve2 ) = GetReservesFromBorrowernumber( $borrowernumber2 ); >+is( $reserve2->{borrowernumber}, $borrowernumber2 ); >+is( $reserve2->{priority}, 0 ); >+is( $reserve2->{itemnumber}, $itemnumber1 ); >+is( $reserve2->{found}, 'W' ); >+ >+( $reserve3 ) = GetReservesFromBorrowernumber( $borrowernumber3 ); >+is( $reserve3->{borrowernumber}, $borrowernumber3 ); >+is( $reserve3->{priority}, 2 ); >+is( $reserve3->{itemnumber}, undef ); >+is( $reserve3->{found}, undef ); >+ >+CancelReserve({ reserve_id => $reserve2->{reserve_id} }); >+ >+( $reserve2 ) = GetReservesFromBorrowernumber( $borrowernumber2 ); >+is( $reserve2, undef ); >+ >+# FIXME >+#( $reserve3 ) = GetReservesFromBorrowernumber( $borrowernumber3 ); >+#is( $reserve3->{borrowernumber}, $borrowernumber3 ); >+#is( $reserve3->{priority}, 0 ); >+#is( $reserve3->{itemnumber}, $itemnumber1 ); >+#is( $reserve3->{found}, 'W' ); >+ >+CancelReserve({ reserve_id => $reserve3->{reserve_id} }); >+ >+( $reserve3 ) = GetReservesFromBorrowernumber( $borrowernumber3 ); >+is( $reserve3, undef ); >+ >+ >+ >+AddIssue( $borrower1, $barcode1 ); >+AddReserve( 'MPL', $borrowernumber2, $biblionumber, 'a', undef, 1, undef, undef, undef, undef, $itemnumber2 ); >+AddReserve( 'MPL', $borrowernumber3, $biblionumber, 'a', undef, 2, undef, undef, undef, undef, $itemnumber2 ); >+ >+( $reserve2 ) = GetReservesFromBorrowernumber( $borrowernumber2 ); >+AddReturn( $barcode1 ); >+ModReserveAffect( $itemnumber2, $borrowernumber2, 1 ); >+ >+( $reserve2 ) = GetReservesFromBorrowernumber( $borrowernumber2 ); >+is( $reserve2->{borrowernumber}, $borrowernumber2 ); >+is( $reserve2->{priority}, 0 ); >+is( $reserve2->{itemnumber}, $itemnumber2 ); >+is( $reserve2->{found}, 'T' ); >+ >+( $reserve3 ) = GetReservesFromBorrowernumber( $borrowernumber3 ); >+is( $reserve3->{borrowernumber}, $borrowernumber3 ); >+is( $reserve3->{priority}, 2 ); >+is( $reserve3->{itemnumber}, $itemnumber2 ); >+is( $reserve3->{found}, undef ); >+ >+CancelReserve({ reserve_id => $reserve2->{reserve_id} }); >+ >+( $reserve2 ) = GetReservesFromBorrowernumber( $borrowernumber2 ); >+is( $reserve2, undef ); >+ >+( $reserve3 ) = GetReservesFromBorrowernumber( $borrowernumber3 ); >+is( $reserve3->{borrowernumber}, $borrowernumber3 ); >+is( $reserve3->{priority}, 0 ); >+is( $reserve3->{itemnumber}, $itemnumber2 ); >+is( $reserve3->{found}, 'T' ); >+ >+CancelReserve({ reserve_id => $reserve3->{reserve_id} }); >+ >+( $reserve3 ) = GetReservesFromBorrowernumber( $borrowernumber3 ); >+is( $reserve3, undef ); >+ >+ >+done_testing; >-- >1.7.10.4
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 10827
:
24551
|
24581
|
24582
|
24583
|
24584
|
24585
|
25942
|
25943
|
25944
|
25945
|
25946
|
36811
|
36812
|
36813
|
36814
|
36815