|
Lines 9-15
use C4::Items;
Link Here
|
| 9 |
use C4::Members; |
9 |
use C4::Members; |
| 10 |
use C4::Reserves; |
10 |
use C4::Reserves; |
| 11 |
|
11 |
|
| 12 |
use Test::More tests => 30; |
12 |
use Test::More tests => 36; |
| 13 |
|
13 |
|
| 14 |
BEGIN { |
14 |
BEGIN { |
| 15 |
use_ok('C4::Circulation'); |
15 |
use_ok('C4::Circulation'); |
|
Lines 283-286
C4::Context->dbh->do("DELETE FROM borrowers WHERE cardnumber = '99999999999'");
Link Here
|
| 283 |
|
283 |
|
| 284 |
} |
284 |
} |
| 285 |
|
285 |
|
|
|
286 |
{ |
| 287 |
# GetUpcomingDueIssues tests |
| 288 |
my $barcode = 'R00000342'; |
| 289 |
my $barcode2 = 'R00000343'; |
| 290 |
my $branch = 'MPL'; |
| 291 |
|
| 292 |
# Create a borrower |
| 293 |
my %a_borrower_data = ( |
| 294 |
firstname => 'Fridolyn', |
| 295 |
surname => 'SOMERS', |
| 296 |
categorycode => 'S', |
| 297 |
branchcode => $branch, |
| 298 |
); |
| 299 |
|
| 300 |
my $a_borrower_borrowernumber = AddMember(%a_borrower_data); |
| 301 |
my $a_borrower = GetMember( borrowernumber => $a_borrower_borrowernumber ); |
| 302 |
|
| 303 |
my $yesterday = DateTime->today(time_zone => C4::Context->tz())->add( days => -1 ); |
| 304 |
my $two_days_ahead = DateTime->today(time_zone => C4::Context->tz())->add( days => 2 ); |
| 305 |
|
| 306 |
my $datedue = AddIssue( $a_borrower, $barcode, $yesterday ); |
| 307 |
my $datedue2 = AddIssue( $a_borrower, $barcode2, $two_days_ahead ); |
| 308 |
|
| 309 |
diag( "GetUpcomingDueIssues tests" ); |
| 310 |
|
| 311 |
for my $i(0..2) { |
| 312 |
my $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => $i } ); |
| 313 |
is ( scalar( @$upcoming_dues ), 0, "No items due in less than two days ($i days in advance)" ); |
| 314 |
} |
| 315 |
|
| 316 |
for my $i(3..5) { |
| 317 |
my $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => $i } ); |
| 318 |
is ( scalar( @$upcoming_dues ), 1, |
| 319 |
"Bug 9362: Only one item due in more than 2 days ($i days in advance)" ); |
| 320 |
} |
| 321 |
|
| 322 |
} |
| 323 |
|
| 286 |
$dbh->rollback; |
324 |
$dbh->rollback; |
| 287 |
- |
|
|