Bugzilla – Attachment 43164 Details for
Bug 5144
Duplicate holds allowed if patron clicks back button after placing hold
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5144 - Add unit test
Bug-5144---Add-unit-test.patch (text/plain), 4.99 KB, created by
Jonathan Druart
on 2015-10-06 12:59:33 UTC
(
hide
)
Description:
Bug 5144 - Add unit test
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-10-06 12:59:33 UTC
Size:
4.99 KB
patch
obsolete
>From feaff9d9d373ba71015160b649af8ef0fe82a2d0 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 5 Oct 2015 07:50:03 -0400 >Subject: [PATCH] Bug 5144 - Add unit test > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/Holds.t | 10 +++++----- > t/db_dependent/Reserves.t | 22 ++++++++++++++++++---- > 2 files changed, 23 insertions(+), 9 deletions(-) > >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index 57cb386..9a44084 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -155,7 +155,7 @@ ok( !$reserve->{'suspend'}, "Test AutoUnsuspendReserves()" ); > # Add a new hold for the borrower whose hold we canceled earlier, this time at the bib level > AddReserve( > $branch_1, >- $borrowernumber, >+ $borrowernumbers[0], > $biblionumber, > my $bibitems = q{}, > my $priority, >@@ -187,19 +187,19 @@ $reserves = GetReservesFromBiblionumber({ biblionumber => $biblionumber, all_dat > $reserve = $reserves->[1]; > AlterPriority( 'top', $reserve->{'reserve_id'} ); > $reserve = GetReserve( $reserve->{'reserve_id'} ); >-ok( $reserve->{'priority'} eq '1', "Test AlterPriority(), move to top" ); >+is( $reserve->{'priority'}, '1', "Test AlterPriority(), move to top" ); > > AlterPriority( 'down', $reserve->{'reserve_id'} ); > $reserve = GetReserve( $reserve->{'reserve_id'} ); >-ok( $reserve->{'priority'} eq '2', "Test AlterPriority(), move down" ); >+is( $reserve->{'priority'}, '2', "Test AlterPriority(), move down" ); > > AlterPriority( 'up', $reserve->{'reserve_id'} ); > $reserve = GetReserve( $reserve->{'reserve_id'} ); >-ok( $reserve->{'priority'} eq '1', "Test AlterPriority(), move up" ); >+is( $reserve->{'priority'}, '1', "Test AlterPriority(), move up" ); > > AlterPriority( 'bottom', $reserve->{'reserve_id'} ); > $reserve = GetReserve( $reserve->{'reserve_id'} ); >-ok( $reserve->{'priority'} eq '5', "Test AlterPriority(), move to bottom" ); >+is( $reserve->{'priority'}, '5', "Test AlterPriority(), move to bottom" ); > > # Regression test for bug 2394 > # >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index bb534c2..4e6fd6f 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 71; >+use Test::More tests => 72; > > use MARC::Record; > use DateTime::Duration; >@@ -153,6 +153,13 @@ $requesters{'CPL'} = AddMember( > categorycode => 'PT', > surname => 'borrower from CPL', > ); >+for my $i ( 2 .. 5 ) { >+ $requesters{"CPL$i"} = AddMember( >+ branchcode => 'CPL', >+ categorycode => 'PT', >+ surname => 'borrower $i from CPL', >+ ); >+} > $requesters{'FPL'} = AddMember( > branchcode => 'FPL', > categorycode => 'PT', >@@ -393,11 +400,12 @@ ModReserveAffect( $itemnumber, $requesters{'CPL'} , 0); #confirm hold > is(defined $results[3]?1:0, 1, 'GetReservesFromItemnumber returns a future wait (confirmed future hold)'); > # End of tests for bug 9788 > >+$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); > # Tests for CalculatePriority (bug 8918) > my $p = C4::Reserves::CalculatePriority($bibnum2); > is($p, 4, 'CalculatePriority should now return priority 4'); > $resdate=undef; >-AddReserve('CPL', $requesters{'CPL'}, $bibnum2, >+AddReserve('CPL', $requesters{'CPL2'}, $bibnum2, > $bibitems, $p, $resdate, $expdate, $notes, > $title, $checkitem, $found); > $p = C4::Reserves::CalculatePriority($bibnum2); >@@ -416,7 +424,7 @@ ModReserveAffect( $itemnumber, $requesters{'CPL'} , 0); > $p = C4::Reserves::CalculatePriority($bibnum); > is($p, 1, 'CalculatePriority should now return priority 1'); > #add another biblio hold, no resdate >-AddReserve('CPL', $requesters{'CPL'}, $bibnum, >+AddReserve('CPL', $requesters{'CPL2'}, $bibnum, > $bibitems, $p, $resdate, $expdate, $notes, > $title, $checkitem, $found); > $p = C4::Reserves::CalculatePriority($bibnum); >@@ -425,7 +433,7 @@ is($p, 2, 'CalculatePriority should now return priority 2'); > C4::Context->set_preference('AllowHoldDateInFuture', 1); > $resdate= dt_from_string(); > $resdate->add_duration(DateTime::Duration->new(days => 1)); >-AddReserve('CPL', $requesters{'CPL'}, $bibnum, >+AddReserve('CPL', $requesters{'CPL3'}, $bibnum, > $bibitems, $p, output_pref($resdate), $expdate, $notes, > $title, $checkitem, $found); > $p = C4::Reserves::CalculatePriority($bibnum); >@@ -435,6 +443,12 @@ $p = C4::Reserves::CalculatePriority($bibnum, $resdate); > is($p, 3, 'CalculatePriority should now return priority 3'); > # End of tests for bug 8918 > >+# Test for bug 5144 >+$reserve_id = AddReserve('CPL', $requesters{'CPL3'}, $bibnum, >+ $bibitems, $p, output_pref($resdate), $expdate, $notes, >+ $title, $checkitem, $found); >+is( $reserve_id, undef, 'Attempt to add a second reserve on a given record for the same patron fails.' ); >+ > # Tests for cancel reserves by users from OPAC. > $dbh->do('DELETE FROM reserves', undef, ($bibnum)); > AddReserve('CPL', $requesters{'CPL'}, $item_bibnum, >-- >2.1.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 5144
:
28657
|
28658
|
28659
|
34983
|
34984
|
34985
|
34986
|
34987
|
34988
|
35090
|
35091
|
35092
|
35093
|
35451
|
40823
|
40824
|
42530
|
42792
|
42848
|
43118
|
43119
|
43120
|
43121
|
43122
|
43125
|
43126
| 43164 |
43165
|
43166
|
43167