Bug 10719 - UT GetUpcomingDueIssues
Some unit tests related to Bug 9362. Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> http://bugs.koha-community.org/show_bug.cgi?id=10606 Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> New and old tests pass. Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
90cf2f3a26
commit
8aef48d5f3
1 changed files with 39 additions and 1 deletions
|
@ -9,7 +9,7 @@ use C4::Items;
|
|||
use C4::Members;
|
||||
use C4::Reserves;
|
||||
|
||||
use Test::More tests => 30;
|
||||
use Test::More tests => 36;
|
||||
|
||||
BEGIN {
|
||||
use_ok('C4::Circulation');
|
||||
|
@ -283,4 +283,42 @@ C4::Context->dbh->do("DELETE FROM borrowers WHERE cardnumber = '99999999999'");
|
|||
|
||||
}
|
||||
|
||||
{
|
||||
# GetUpcomingDueIssues tests
|
||||
my $barcode = 'R00000342';
|
||||
my $barcode2 = 'R00000343';
|
||||
my $branch = 'MPL';
|
||||
|
||||
# Create a borrower
|
||||
my %a_borrower_data = (
|
||||
firstname => 'Fridolyn',
|
||||
surname => 'SOMERS',
|
||||
categorycode => 'S',
|
||||
branchcode => $branch,
|
||||
);
|
||||
|
||||
my $a_borrower_borrowernumber = AddMember(%a_borrower_data);
|
||||
my $a_borrower = GetMember( borrowernumber => $a_borrower_borrowernumber );
|
||||
|
||||
my $yesterday = DateTime->today(time_zone => C4::Context->tz())->add( days => -1 );
|
||||
my $two_days_ahead = DateTime->today(time_zone => C4::Context->tz())->add( days => 2 );
|
||||
|
||||
my $datedue = AddIssue( $a_borrower, $barcode, $yesterday );
|
||||
my $datedue2 = AddIssue( $a_borrower, $barcode2, $two_days_ahead );
|
||||
|
||||
diag( "GetUpcomingDueIssues tests" );
|
||||
|
||||
for my $i(0..2) {
|
||||
my $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => $i } );
|
||||
is ( scalar( @$upcoming_dues ), 0, "No items due in less than two days ($i days in advance)" );
|
||||
}
|
||||
|
||||
for my $i(3..5) {
|
||||
my $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => $i } );
|
||||
is ( scalar( @$upcoming_dues ), 1,
|
||||
"Bug 9362: Only one item due in more than 2 days ($i days in advance)" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$dbh->rollback;
|
||||
|
|
Loading…
Reference in a new issue