|
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 266-269
C4::Context->dbh->do("DELETE FROM borrowers WHERE cardnumber = '99999999999'");
Link Here
|
| 266 |
|
266 |
|
| 267 |
} |
267 |
} |
| 268 |
|
268 |
|
|
|
269 |
{ |
| 270 |
# GetUpcomingDueIssues tests |
| 271 |
my $barcode = 'R00000342'; |
| 272 |
my $barcode2 = 'R00000343'; |
| 273 |
my $branch = 'MPL'; |
| 274 |
|
| 275 |
# Create a borrower |
| 276 |
my %a_borrower_data = ( |
| 277 |
firstname => 'Fridolyn', |
| 278 |
surname => 'SOMERS', |
| 279 |
categorycode => 'S', |
| 280 |
branchcode => $branch, |
| 281 |
); |
| 282 |
|
| 283 |
my $a_borrower_borrowernumber = AddMember(%a_borrower_data); |
| 284 |
my $a_borrower = GetMember( borrowernumber => $a_borrower_borrowernumber ); |
| 285 |
|
| 286 |
my $yesterday = DateTime->today(time_zone => C4::Context->tz())->add( days => -1 ); |
| 287 |
my $two_days_ahead = DateTime->today(time_zone => C4::Context->tz())->add( days => 2 ); |
| 288 |
|
| 289 |
my $datedue = AddIssue( $a_borrower, $barcode, $yesterday ); |
| 290 |
my $datedue2 = AddIssue( $a_borrower, $barcode2, $two_days_ahead ); |
| 291 |
|
| 292 |
diag( "GetUpcomingDueIssues tests" ); |
| 293 |
|
| 294 |
for my $i(0..2) { |
| 295 |
my $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => $i } ); |
| 296 |
is ( scalar( @$upcoming_dues ), 0, "No items due in less than two days ($i days in advance)" ); |
| 297 |
} |
| 298 |
|
| 299 |
for my $i(3..5) { |
| 300 |
my $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => $i } ); |
| 301 |
is ( scalar( @$upcoming_dues ), 1, |
| 302 |
"Bug 9362: Only one item due in more than 2 days ($i days in advance)" ); |
| 303 |
} |
| 304 |
|
| 305 |
} |
| 306 |
|
| 269 |
$dbh->rollback; |
307 |
$dbh->rollback; |
| 270 |
- |
|
|