Bug 15757: Add one test for GetLoanLength

The usual call (3 params) of this subroutine was not tested.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit d83aff33c6)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
Jonathan Druart 2016-04-07 09:44:51 +01:00 committed by Julian Maurice
parent f2c5b7b036
commit 271cbb949a
1 changed files with 15 additions and 6 deletions

View File

@ -6,7 +6,7 @@ use C4::Branch;
use DateTime;
use Koha::DateUtils;
use Test::More tests => 9;
use Test::More tests => 10;
BEGIN {
use_ok('C4::Circulation');
@ -115,7 +115,7 @@ my $sampleissuingrule1 = {
maxissueqty => 5,
maxonsiteissueqty => 4,
finedays => 0,
lengthunit => 'Null',
lengthunit => 'days',
renewalperiod => 5,
norenewalbefore => 6,
auto_renew => 0,
@ -149,7 +149,7 @@ my $sampleissuingrule2 = {
auto_renew => 0,
reservesallowed => 'Null',
issuelength => 2,
lengthunit => 'Null',
lengthunit => 'days',
hardduedate => 2,
hardduedatecompare => 'Null',
fine => 'Null',
@ -179,7 +179,7 @@ my $sampleissuingrule3 = {
auto_renew => 0,
reservesallowed => 'Null',
issuelength => 3,
lengthunit => 'Null',
lengthunit => 'days',
hardduedate => 3,
hardduedatecompare => 'Null',
fine => 'Null',
@ -327,7 +327,7 @@ is_deeply(
$samplecat->{categorycode},
'BOOK', $samplebranch1->{branchcode}
),
{ issuelength => 5, lengthunit => 'Null', renewalperiod => 5 },
{ issuelength => 5, lengthunit => 'days', renewalperiod => 5 },
"GetLoanLength"
);
is_deeply(
@ -364,8 +364,17 @@ is_deeply(
renewalperiod => 21,
lengthunit => 'days',
},
"With only one parameter, GetLoanLength returns hardcoded values"
"With only two parameters, GetLoanLength returns hardcoded values"
); #NOTE : is that really what is expected?
is_deeply(
C4::Circulation::GetLoanLength( $samplecat->{categorycode}, 'BOOK', $samplebranch1->{branchcode} ),
{
issuelength => 5,
renewalperiod => 5,
lengthunit => 'days',
},
"With the correct number of parameters, GetLoanLength returns the expected values"
);
#Test GetHardDueDate
my @hardduedate = C4::Circulation::GetHardDueDate( $samplecat->{categorycode},