11 use Test::More tests => 8;
12 C4::Context->_new_userenv(1234567);
13 C4::Context->set_userenv(91, 'CLIstaff', '23529001223661', 'CPL',
14 'CPL', 'CPL', '', 'cc@cscnet.co.uk');
17 my $test_patron = '23529001223651';
18 my $test_item_fic = '502326000402';
19 my $test_item_24 = '502326000404';
20 my $test_item_48 = '502326000403';
22 my $borrower1 = GetMember(cardnumber => $test_patron);
23 my $item1 = GetItem (undef,$test_item_fic);
26 skip 'Missing test borrower or item, skipping tests', 8
27 unless ( defined $borrower1 && defined $item1 );
29 for my $item_barcode ( $test_item_fic, $test_item_24, $test_item_48 ) {
30 my $duedate = try_issue( $test_patron, $item_barcode );
31 isa_ok( $duedate, 'DateTime' );
32 if ( $item_barcode eq $test_item_fic ) {
33 is( $duedate->hour(), 23, "daily loan hours = 23" );
34 is( $duedate->minute(), 59, "daily loan mins = 59" );
36 my $ret_ok = try_return($item_barcode);
37 is( $ret_ok, 1, 'Return succeeded' );
42 my ($cardnumber, $item ) = @_;
43 my $issuedate = '2011-05-16';
44 my $borrower = GetMemberDetails(0, $cardnumber);
45 my ($issuingimpossible,$needsconfirmation) = CanBookBeIssued( $borrower, $item );
46 my $issue = AddIssue($borrower, $item, undef, 0, $issuedate);
47 return dt_from_string( $issue->due_date() );
52 my ($ret, $messages, $iteminformation, $borrower) = AddReturn($barcode);