Bugzilla – Attachment 26231 Details for
Bug 11934
Replace given by if-else in Circulation_issuingrules.t
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11934 - Replace given by if-else statments
Bug-11934---Replace-given-by-if-else-statments.patch (text/plain), 3.04 KB, created by
Nicolas Legrand
on 2014-03-13 09:46:19 UTC
(
hide
)
Description:
Bug 11934 - Replace given by if-else statments
Filename:
MIME Type:
Creator:
Nicolas Legrand
Created:
2014-03-13 09:46:19 UTC
Size:
3.04 KB
patch
obsolete
>From bc4ae4e98a21f8e1418c39c6c9e7b761cb39266b Mon Sep 17 00:00:00 2001 >From: Nicolas Legrand <nicolas.legrand@bulac.fr> >Date: Thu, 13 Mar 2014 10:40:27 +0100 >Subject: [PATCH] Bug 11934 - Replace given by if-else statments > >--- > t/db_dependent/Circulation_issuingrules.t | 59 +++++++++++++++++++------------ > 1 file changed, 37 insertions(+), 22 deletions(-) > >diff --git a/t/db_dependent/Circulation_issuingrules.t b/t/db_dependent/Circulation_issuingrules.t >index 1b9f3fd..956bc59 100644 >--- a/t/db_dependent/Circulation_issuingrules.t >+++ b/t/db_dependent/Circulation_issuingrules.t >@@ -61,13 +61,18 @@ is_deeply($loanlength, $default, 'none matches'); > > #Set syspref ReturnBeforeExpiry = 1 and useDaysMode = 'Days' > $contextmodule->mock('preference', sub { >- my ($self, $syspref) = @_; >- given ( $syspref ) { >- when ("ReturnBeforeExpiry"){ return 1; } >- when ("useDaysMode"){ return 'Days'; } >- default{ return; } >- } >-}); >+ my ($self, $syspref) = @_; >+ if ( $syspref eq "ReturnBeforeExpiry") { >+ return 1; >+ } >+ elsif ( $syspref eq "useDaysMode") { >+ return 'Days'; >+ } >+ else { >+ return; >+ } >+ } >+ }); > > my $dateexpiry = '2013-01-01'; > >@@ -76,20 +81,24 @@ my $start_date = DateTime->new({year => 2013, month => 2, day => 9}); > $dbh->{mock_add_resultset} = $mock_loan_length; > my $date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower ); > is($date, $dateexpiry . 'T23:59:00', 'date expiry'); >- > $dbh->{mock_add_resultset} = $mock_loan_length; > $date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower, 1 ); > > > #Set syspref ReturnBeforeExpiry = 1 and useDaysMode != 'Days' > $contextmodule->mock('preference', sub { >- my ($self, $syspref) = @_; >- given ( $syspref ) { >- when ("ReturnBeforeExpiry"){ return 1; } >- when ("useDaysMode"){ return 'noDays'; } >- default{ return; } >- } >-}); >+ my ($self, $syspref) = @_; >+ if ( $syspref eq "ReturnBeforeExpiry") { >+ return 1; >+ } >+ elsif ($syspref eq "useDaysMode") { >+ return 'noDays'; >+ } >+ else { >+ return; >+ } >+ } >+ }); > > $borrower = {categorycode => 'B', dateexpiry => $dateexpiry}; > $start_date = DateTime->new({year => 2013, month => 2, day => 9}); >@@ -103,13 +112,19 @@ $date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borr > > #Set syspref ReturnBeforeExpiry = 0 and useDaysMode = 'Days' > $contextmodule->mock('preference', sub { >- my ($self, $syspref) = @_; >- given ( $syspref ) { >- when ("ReturnBeforeExpiry"){ return 0; } >- when ("useDaysMode"){ return 'Days'; } >- default{ return; } >- } >-}); >+ my ($self, $syspref) = @_; >+ if ( $syspref eq "ReturnBeforeExpiry") { >+ return 0; >+ } >+ elsif ( $syspref eq "useDaysMode") { >+ return 'Days'; >+ } >+ else { >+ default >+ return; >+ } >+ } >+ }); > > $borrower = {categorycode => 'B', dateexpiry => $dateexpiry}; > $start_date = DateTime->new({year => 2013, month => 2, day => 9}); >-- >1.8.3.2
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 11934
:
26231
|
26238
|
26242
|
26248
|
26272