Bugzilla – Attachment 31414 Details for
Bug 12876
Reserve in waiting/transfer status may be cancelled by user
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12876: Improve unit tests for CanReserveBeCanceledFromOpac
Bug-12876-Improve-unit-tests-for-CanReserveBeCance.patch (text/plain), 2.03 KB, created by
Jonathan Druart
on 2014-09-05 15:42:40 UTC
(
hide
)
Description:
Bug 12876: Improve unit tests for CanReserveBeCanceledFromOpac
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-09-05 15:42:40 UTC
Size:
2.03 KB
patch
obsolete
>From abe7cf2c32ab289a97aa9c7cc8e93dd97e2d408f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 5 Sep 2014 17:40:05 +0200 >Subject: [PATCH] Bug 12876: Improve unit tests for > CanReserveBeCanceledFromOpac > >This patch fix the subroutine name and add a restriction on the >arguments: both argument are mandatory! > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > C4/Reserves.pm | 1 + > t/db_dependent/Reserves.t | 16 +++++++++++++++- > 2 files changed, 16 insertions(+), 1 deletion(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 54b674d..c6bc35f 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -571,6 +571,7 @@ sub CanItemBeReserved{ > sub CanReserveBeCanceledFromOpac { > my ($reserve_id, $borrowernumber) = @_; > >+ return unless $reserve_id and $borrowernumber; > my $reserve = GetReserve($reserve_id); > > return 0 unless $reserve->{borrowernumber} == $borrowernumber; >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index ed7e31e..707d57b 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -2,7 +2,7 @@ > > use Modern::Perl; > >-use Test::More tests => 39; >+use Test::More tests => 42; > > use MARC::Record; > use DateTime::Duration; >@@ -402,6 +402,20 @@ AddReserve('CPL', $requesters{'CPL'}, $item_bibnum, > $title, $checkitem, ''); > my (undef, $canres, undef) = CheckReserves($itemnumber); > >+is( CanReserveBeCanceledFromOpac(), undef, >+ 'CanReserveBeCanceledFromOpac should return undef if called without any parameter' >+); >+is( >+ CanReserveBeCanceledFromOpac( $canres->{resserve_id} ), >+ undef, >+ 'CanReserveBeCanceledFromOpac should return undef if called without the reserve_id' >+); >+is( >+ CanReserveBeCanceledFromOpac( undef, $requesters{CPL} ), >+ undef, >+ 'CanReserveBeCanceledFromOpac should return undef if called without borrowernumber' >+); >+ > my $cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{'CPL'}); > is($cancancel, 1, 'Can user cancel its own reserve'); > >-- >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 12876
:
31393
|
31404
|
31406
|
31413
|
31414
|
31440
|
31441
|
31846